[antlr-interest] Re: Type Checker Implementation Question

Florian moon_ari at hotmail.com
Thu Mar 16 13:50:21 PST 2006


Hello,

Mark Felzer <mark.felzer at ...> writes:
> Hey group!
> 
> I am planning to implement a type-checker, for an existing AST, I build 
> with the ANTLR.
> I am weighting the option of embedding symbol table generation and 
> checking into the the parser / tree walker grammar V.S. creating a 
> separate application that analyzes the AST generating a symbol table.
> 
> Any advise which way I should go? Which implementation would be easier 
> and more intuitive?
> 
> Thank you,
> -Mark

My choice is to type-check as soon as I've built a complete AST for an
expression, but without waiting to parse the whole input. This allows to keep
error messages in order (syntactic ones and typechecking ones) while preserving
separation of parsing and typechecking code.

I do symbol generation in the parser -- added code is small: lookup symbol
table, assign the symbol found, insert symbol in symbol table.

Florian.





More information about the antlr-interest mailing list