Re: Statement at a time parsing with yacc

d87-jse@nada.kth.se (Joakim Sernbrant)
Tue, 17 Dec 91 18:13:41 GMT

          From comp.compilers

Related articles
Statement at a time parsing with yacc przemek@viewlogic.com (1991-12-06)
Re: Statement at a time parsing with yacc bart@cs.uoregon.edu (1991-12-10)
Re: Statement at a time parsing with yacc bliss@sp64.csrd.uiuc.edu (1991-12-10)
Re: Statement at a time parsing with yacc chris@mks.com.ca (1991-12-11)
Statement at a time parsing with yacc compres!chris@crackers.clearpoint.com (1991-12-12)
Re: Statement at a time parsing with yacc d87-jse@nada.kth.se (1991-12-17)
| List of all articles for this month |

Newsgroups: comp.compilers
From: d87-jse@nada.kth.se (Joakim Sernbrant)
Keywords: yacc, parse
Organization: Royal Institute of Technology, Stockholm, Sweden
References: 91-12-036
Date: Tue, 17 Dec 91 18:13:41 GMT

przemek@viewlogic.com (Przemek Skoskiewicz) writes:


>I have a nifty parser for a C-like language. I can run it on a file or a
>string containing one statement and everything is cool. What I want it to
>do is to point to a file and ask it to parse *one* statement only, even if
>there are many statements in sequence in the file.


Here is how I used yacc as a parser for a database system where one
line/statement was read from the keyboard, parsed, and then processed
by the database manager.


reader: statement ';'
{ YYACCEPT; }
;


statement
: close_statement
| create_statement
| delete_statement
[...]
| update_statement
| error ';'
{ error("invalid statement"); YYABORT; }
;


I'm not sure if this has anything to do with you problem though :)


Jocke


--
-- Joakim Sernbrant, Royal Institute of Technology, Stockholm, Sweden
-- Internet: d87-jse@nada.kth.se
[This doesn't solve the problem of yacc telling the lexer when the input is
done if there is a readahead token. -John]
--


Post a followup to this message

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