How can I 'unroll' a YACC generated parser?

pitchl@tdbank.ca
12 Mar 1998 23:19:19 -0500

          From comp.compilers

Related articles
How can I 'unroll' a YACC generated parser? pitchl@tdbank.ca (1998-03-12)
Re: How can I 'unroll' a YACC generated parser? resslere@erols.com (resslere) (1998-03-15)
Re: How can I 'unroll' a YACC generated parser? a010111t@bc.seflin.org (Orlando Llanes) (1998-03-18)
| List of all articles for this month |

From: pitchl@tdbank.ca
Newsgroups: comp.compilers
Date: 12 Mar 1998 23:19:19 -0500
Organization: Deja News - The Leader in Internet Discussion
Keywords: yacc, question

I have a hand-coded program that processes a string of commands to
create a data record. There is a grammar associated to this string of
commands, and I would like to replace the hand-coded program with
something generated from Yacc.


However, this is not a standalone program; instead of it providing the
loop control, looping is provided for it outside of the program. To be
exact, the hand-coded program provides an API to other, higher-level,
programs.


What I need to do is 'unroll' a Yacc generated parser, so that the
entrypoint of the parser is where the next token is provided. This
would allow the API caller to pass a single token to the parser with
each invocation.


Pictorially, this looks like...


                typical YACC-generated parser what I want


                                      ! <get token>
                                      ! !
                            +--->! !
                            ! +----+ !
                            ! ! !
                            ! <get token> !
                            ! ! !
                            ! +----+ !
                            ! ! !
                            ! <process token> <process token>
                            ! ! !
                            +----+ !
                                      ! !
                                  <exit> <exit>




The calling program would be responsible for the iteration through the
parser, providing a single token to each iteration.


Does anyone know of a parser generator that will accept a Yacc-like
grammar definition and produce an 'unrolled' parser?


Thanks....




Lew Pitcher
System Consultant, Delivery Systems Architecture
Toronto Dominion Bank
--


Post a followup to this message

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