90 likes | 209 Views
Project Part 2: Parser. Project Part 2: Parser. Bison. Bison. Command line: bison –d translate.y. Command line: flex filename.l gcc y.tab.c lex.yy.c - lfl. Input to Bison. Input to Bison. Input to Bison. semantic actions (sequence of C statements ). Default semantic
E N D
Project Part 2: Parser Bison Bison Command line: bison –d translate.y Command line: flex filename.l gccy.tab.clex.yy.c -lfl
Input to Bison semantic actions (sequence of C statements ) Default semantic action is $$=$1 unquoted strings not declared as tokens are taken as nonterminals $$ attribute value of production head $iattribute value of ith symbol in production body
bison + flex • First use flex to generate yy.lex.c without mainfunction • In input to bison, put #include “yy.lex.c” in the declaration part of the file Or • Compile both c files with gcc