From c91cb5aed3054f0bba98d9d35dd07f7c1ad0ffff Mon Sep 17 00:00:00 2001 From: chak Date: Wed, 12 Dec 2001 06:48:20 +0000 Subject: [PATCH] [project @ 2001-12-12 06:48:20 by chak] Added some more details about parsing. --- ghc/docs/comm/the-beast/syntax.html | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ghc/docs/comm/the-beast/syntax.html b/ghc/docs/comm/the-beast/syntax.html index d54b4ee..d337315 100644 --- a/ghc/docs/comm/the-beast/syntax.html +++ b/ghc/docs/comm/the-beast/syntax.html @@ -59,6 +59,22 @@ data ParseResult a = POk PState a for GHCi. All three require a parser state (of type PState) and are invoked from HscMain. +

+ Parsing of Haskell is a rather involved process. The most challenging + features are probably the treatment of layout and expressions that + contain infix operators. The latter may be user-defined and so are not + easily captured in a static syntax specification. Infix operators may + also appear in the right hand sides of value definitions, and so, GHC's + parser treats those in the same way as expressions. In other words, as + general expressions are a syntactic superset of expressions - ok, they + nearly are - the parser simply attempts to parse a general + expression in such positions. Afterwards, the generated parse tree is + inspected to ensure that the accepted phrase indeed forms a legal + pattern. This and similar checks are performed by the routines from ParseUtil. In + some cases, these routines do, in addition to checking for + wellformedness, also transform the parse tree, such that it fits into the + syntactic context in which it has been parsed.

The Haskell Interface Parser

@@ -73,7 +89,7 @@ data ParseResult a = POk PState a

-Last modified: Sun Nov 18 21:22:38 EST 2001 +Last modified: Wed Dec 12 17:45:36 EST 2001 -- 1.7.10.4