|Semantical checks that involve flow of execution of the program firstname.lastname@example.org (Lujop) (2004-10-17)|
|Re: Semantical checks that involve flow of execution of the program email@example.com (John Max Skaller) (2004-10-21)|
|Re: Semantical checks that involve flow of execution of the program firstname.lastname@example.org (ChokSheak Lau) (2004-10-21)|
|Date:||17 Oct 2004 16:09:46 -0400|
|Posted-Date:||17 Oct 2004 16:09:46 EDT|
I'm writting a compiler for a pseudocode language similar to Java. I
use a pred-LL(1) parser (with ANTLR) and I construct an AST that I
walk several times (currently twice) to do the semantical checking.
Well my question is that I want to do some intelligent checks for
program flow like Java does.
For example in variable initialization:
//var a is not inicialized
if codition1 then
a <- 1
else if codition2 then
a <- 1
With this example Java says that 'a' is possibly not initialized
because branch 2 don't assign any value in a.
The problem, is that I don't know how to do this checks (also I want
to do this checks for return of methods).
I have an AST and a symbol table but I have been thinking a little
about it and I can't find a solution.
Can one can give me a solution, or point me to some readings to solve
this problem and say if this is difficult or easy.
A lot of thanks in advance,
Joan Jesús Pujol Espinar
Return to the
Search the comp.compilers archives again.