[antlr-interest] Storing variable datatypes in a symbol table

Priya priya.uky at gmail.com
Wed Jan 18 15:37:28 PST 2006


Hi Everyone ,

I'm trying to build a symbol table for my compiler designed using ANTLR .
I have seen in the <lexername>.cpp code that  each token is assigned a
unique token number in the initLiterals() function... as in :

literals["int"]=19;
literals["float"]=20 ; etc in my case .

I am currently using these token type numbers to distinguish between
variables of different datatypes and storing the same in my symbol
table .

Using this stored datatype information i intend to check the variables
on either side of a given expression to be of the same datatype.

Is this thestandard way of storing datatypes in a symbol table ? or is
there another way to do it ?
Thanks in advance
Priya


More information about the antlr-interest mailing list