Random extra stuff Flashcards
1
Q
What is does lex do?
A
● takes as input a file simple.l with the regular
expressions that describe the different tokens.
● It generates a scanner file “lex.yy.c” that reads
characters and forms tokens or words that the
parser uses.
2
Q
What does yacc do?
A
● Takes as input a file simple.y with the grammar that describes the language.
● This file also contains “actions” that is “C” code that describes how the code will be generated
while parsing the code.
● It generates a parser file called “y.tab.c” that reads the tokens and parses the program
according to the syntax.
● When it reaches an action in the syntax tree, itexecutes that action
3
Q
A