CS143 Compilers

Other compiler courses

F# links

Lexer notes

It is a C function that returns an integer, which is a code for one of the possible token names. The attribute value, whether it be another numeric code, a pointer to the symbol table, or nothing, is placed in a global variable yylval (in our case — cool_yylval), which is shared between the lexical analyzer and parser, thereby making it simple to return both the name and an attribute value of a token.