You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are currently working on typedef but we don't know what to do in term of getting back variables from C++ files which would be called at parser back to lexer. From what we knew, to let lexer recognizes some typedef types and return a type token, it needs to know the name of that correspond type first, differentiating them from normal identifier.
The text was updated successfully, but these errors were encountered:
Yes this is the "lexer hack". I suggest you have the parser maintain a list of identifiers that have been typedef'd. E.g. when it encounters typedef int foo, it adds foo to that list. The lexer also has access to that list, and each time it lexes something that looks like an identifier, it sees if it appears in that list. If it does, then it lexes it as a typeident, and if it doesn't, it lexes it as a varident. (Or whatever names you want to use.)
sorry, but we don't really know how to provided "symbol table access from parser to lexer". Besides the yyparse() function between parser and lexer are there any other ways they could be linked together? We tried searching online but nothing comes handy. Are there any resources which elaborates on that ? thank you.
We are currently working on typedef but we don't know what to do in term of getting back variables from C++ files which would be called at parser back to lexer. From what we knew, to let lexer recognizes some typedef types and return a type token, it needs to know the name of that correspond type first, differentiating them from normal identifier.
The text was updated successfully, but these errors were encountered: