wall@decwrl.UUCP (David Wall) (05/22/84)
Steven Maurer: Anyone who is a serious student of programming linguistics, should realize that a delimiter is neccessary to separate the expression from the statement in all conditional language-constucts -- if you want to keep your grammer LALR(1) (almost a given). Not right, not right! The delimiter separating the expression from the statement is mostly an artifact of the obsolete techniques of precedence parsing. Pascal would be just as LALR(1) if THEN were removed from the syntax. Write up a test grammar and feed to YACC and you'll see. Such particles still exist for historical reasons and because they sometimes make it easier to recover the parse when there are syntax errors, but they are not necessary. (Pascal doesn't need the semicolons either; how about that?) You *DO* need a delimiter in C, because of the highly overloaded prefix, infix, and postfix operators, and because any expression can be a statement. Without the delimiter, "if a ++ b" could mean either "if (a) ++b" or "if (a++) b". And "if a*b*c" could mean either "if (a) *b * c" or "if (a*b) *c". This would make the language ambiguous. An ambiguous language is not LALR, but this is the least of your worries in that case. David Wall DEC Western Research Lab