Hello,
I am developing a small compiler which recognizes expression like 10+20,10-1*30 and so on. I am using Lex for generating Lexer and Yacc for parser. I created a header file defining the integer values for tokens and this header was included in both lexer and parser. Actually, I assigned some wrong values to tokens and parser did not work. Then I corrected the values and parser worked correctly. I want to know if there is any technique by which I can use both lex and yacc to build a compiler and "avoid assigning values" to tokens. i.e. I want some way so that the lexer sends the token back to parser and parser recognizes its correct type.
Thanx in advance.
I am developing a small compiler which recognizes expression like 10+20,10-1*30 and so on. I am using Lex for generating Lexer and Yacc for parser. I created a header file defining the integer values for tokens and this header was included in both lexer and parser. Actually, I assigned some wrong values to tokens and parser did not work. Then I corrected the values and parser worked correctly. I want to know if there is any technique by which I can use both lex and yacc to build a compiler and "avoid assigning values" to tokens. i.e. I want some way so that the lexer sends the token back to parser and parser recognizes its correct type.
Thanx in advance.
Comment