Announcement

Collapse
No announcement yet.

c++ Parser

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • c++ Parser

    hey all, i am trying to use the lemon parser for c++ and i have to clue how to use it, and i dont understand the tutorial it came with, heres what it says incase you have no idea what im talking wbout but inderstand what the tutorial is sayin,


    The parser generator (lemon.c and lempar.c) takes the input from the syntax file "example1.y" and creates the parser file "example1.c", along with two other files "example1.h", which contains definitions for the tokens, and "example1.out", which gives a detailed listing of the shift reduce states for the grammar listed in "example1.y".
    Let's run through the steps, starting first with compiling the source code of lemon (available here). The first step is to compile lemon.c:

    <CODE> $ gcc -o lemon lemon.c</CODE></PRE>
    Now we have our parser generator, <CODE>lemon</CODE>, so run the syntax file "example1.y" through it.

    <CODE> $ ./lemon example1.y</CODE></PRE>
    This will create example1.c, example1.h, and example1.out. What about lempar.c? Compare "example1.c" with "lempar.c", and you will see that it contains a lot of the same code. "lempar.c" is a template file. You can modify the code if you want, and all modifications will be passed to "example1.c" (including any comments). But "example1.c" is not complete. We'll append the contents of the file "main_part", which contains a main function and tokens. "main_part" is called a driver.

    if you can help POST i am in a hurry! (tried google already)
    Thanks
Working...
X