Re: Making semicolons optional moves LALR(1) language to LALR(2)?

"ng2010" <ng2010@att.invalid>
Sat, 6 Feb 2010 18:42:06 -0600

          From comp.compilers

Related articles
Making semicolons optional moves LALR(1) language to LALR(2)? ng2010@att.invalid (ng2010) (2010-02-05)
Re: Making semicolons optional moves LALR(1) language to LALR(2)? cr88192@hotmail.com (BGB / cr88192) (2010-02-06)
Re: Making semicolons optional moves LALR(1) language to LALR(2)? ng2010@att.invalid (ng2010) (2010-02-06)
Re: Making semicolons optional moves LALR(1) language to LALR(2)? kkylheku@gmail.com (Kaz Kylheku) (2010-02-08)
| List of all articles for this month |
From: "ng2010" <ng2010@att.invalid>
Newsgroups: comp.compilers
Date: Sat, 6 Feb 2010 18:42:06 -0600
Organization: A noiseless patient Spider
References: 10-02-025
Keywords: parse, LALR
Posted-Date: 10 Feb 2010 11:01:24 EST

"ng2010" <ng2010@att.invalid> wrote in message
> For a hypothetical programming language that is LALR(1) and uses
> semicolons as statement terminators, would a change that makes
> semicolons
> only required on multi-statement lines and using the newline as an
> implicit statement terminator make the language LALR(2)?
> [Seems to me that it makes a newline syntactically equivalent to a
> semicolon, unless you
> have some plan for multi-line statements you haven't mentioned. -John]


I don't remember the example I had in mind, but it was the one below,
then I was thinking
incorrectly:


void myfunc() // is this a function declaration or a definition?
{ // it was the start of a definition afterall, but the parser implicitly
// terminated the above line and thought it was a declaration. Or at
least it would seem
// that the parser is complicated by not having an explicit stmt
terminator. But how much?
}


I think I was thinking that the lookahead token would be the newline
rather than the next "real" token.



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.