Related articles |
---|
parse last line aw0g+@andrew.cmu.edu (Aaron Wohl) (1995-02-17) |
Re: parse last line umrigar@cs.binghamton.edu (Zerksis D. Umrigar) (1995-02-21) |
Re: parse last line jpowers@ti.com (1995-02-21) |
Newsgroups: | comp.compilers |
From: | jpowers@ti.com |
Keywords: | lex, parse |
Organization: | Texas Instruments |
References: | 95-02-134 |
Date: | Tue, 21 Feb 1995 18:50:52 GMT |
<aw0g+@andrew.cmu.edu> writes:
> How do folks handle parsing the last line of input?
>
> I am using lex/yacc for a new compiler for an obscure basic dialect
> that up until now has only been interpreted. It is fairly common
> for the basic programs to not have and end of line character on the
> last line. My grammar looks like:
[snip]
Change your grammar to make EOL a statement separator instead of a
statement ender.
program:
stmtlist
;
stmtlist:
stmt
| stmtlist EOL stmt
;
regards, jpp@ti.com
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.