-
Notifications
You must be signed in to change notification settings - Fork 160
Open
Description
- On page 32, while defining the first draft of a Lark grammar for Lint language, stmt is not defined.
- On the bottom of the page 32, assuming that stmt is defined as
stmt: "print" "(" exp ")" | exp, the parsed result for the input1+3in invalid. Actually, the generated tree does not contain any stmt_list Tree object. It must be some thing like:
Tree('lang_int', [Tree('stmt_list', [Tree('stmt', [Tree('exp', [Tree('exp', [Token('INT', '1')]), Tree('exp', [Token('INT', '3')])])]), Token('NEWLINE', '\n'), Tree('stmt_list', [])])])
3. The grammar in Figure 3.3 does not accept single line programs such as ‘1+2’ while ‘1+2\n’ is acceptable. To accept single line programs we the grammar must be updated as follows:
stmt_list:
| stmt NEWLINE stmt_list -> add_stmt
| stmt -> single_line
- In section 3.5 the last sentence of the second paragraph "A dotted rule is simply a grammar rule with a period indicating how much of its
right-hand side has already been parsed" must be modified to "... how much of its left-hand side has already been parsed. Also, in the next sentence "... an exp followed by + but has not yet parsed an exp to the right of +." must be "... an exp followed by + but has not yet parsed an exp_hi to the right of +." - On the bottom of the page 41 in the second pullet point, the sentence "If there there is a shift edge ..." one "there" is extra.
Metadata
Metadata
Assignees
Labels
No labels