Hello! Is there anybody who can help me?

I'm building a Compiler for Haskell and have the following problem:

I want to build the layout expansion ('{', '}' and ';')
into the scanner.

The Report (version 1.1) states that "a close brace is also
inserted whenever the syntactic category containing the declaration
list ends; that is, if an illegal lexeme is encountered at a point
where a close brace would be legal, a close brace is inserted" (page 4).

Due to this description, the layout can (in some cases) be expanded only
by the parser, as the scanner cannot "know" when a syntactical category
comes to an end.

Since I try to include this expander in the scanner, I tried to figure
out which the cases might be, in which such "syntactical categories" end,
independently from the layout.

The only constructs I found are "(...)", "[...]", "{...}" and "let ... in".

The question I'm raising is, if anybody knows a general rule for finding
out this categories (I did it intuitively), or at least, if anybody knows
other constructs where this problem arises.

An example can be found in the Report (ver. 1.1, pp.4-5): the two close
braces which were inserted because the tuple ended (fifth line from the
bottom in Figure 2).

I'm thankful for even the smallest suggestion.

Georg Botorog
([EMAIL PROTECTED])


Reply via email to