[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Non-textual semantic values for Tokens?



> 
> For a compiler to be modular, it is essential that the addition and/or removal
> of a compiler phase not to require much changes to existing code.  In fact,
> with a SableCC compiler framework, dependencies can be minimal, if not
> eliminated in some cases.  This cannot be achieved if analysis specific
> information is kept in the AST itself.  Personally, I think that the few
> additional CPU cycles it takes to extract the data out of the hastable instead
> of the AST are really worth it in the long term, from a software engineering
> point of view.
....

Yes, Etienne, I agree that for storing data flow information and other
semantic information like types,  the hashtable idea is not bad.   However,
I think that for the value of tokens,  there is a valid reason to want to
actually store a value that matches the kind of token.   For example, if
you are parsing an integer token,  doesn't it make sense for the token's
value to be integer,  and the value in the parse tree to be integer?

Laurie