Reputation: 1956
I'm doing compiler construction class but I'm having a lot of confusions. I know what .l and .y file do but it's not clear to me how they are incorporated? Where is the symbol table declared? In .l, .y or in other .c file and to make a simple compiler is .l and .y file required?
Please give me examples as it's easier for me to understand seeing examples. Thanks.
Upvotes: 1
Views: 179
Reputation: 111369
The symbol table would be declared in other .c and .h files, separate from lex
and yacc
files.
Lex (.l files) and Yacc (.y files) help in compiler construction, but not strictly necessary. You can write the lexer and parser by hand, for example.
Upvotes: 1