<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>I love replying to myself ;-)</div><div><br></div><div>I found some way of achieving the implicit uppercast, but not using a tree grammar.</div><div>I wrote my grammar to distinguish between int and float expressions right from the start.</div><div>Unfortunately I now run into trouble. I added boolean expressions to my grammar and cannot find a way to</div><div>make boolean expression like:</div><div><br></div><div>bool a := 3&lt;4</div><div><br></div><div>work, but prevent my grammar from accepting things like</div><div><br></div><div>bool a:=4</div><div><br></div><div>which is obviously bad.&nbsp;</div><div>So I had a look at the Java grammars on antlr.org and found that, they do not impose type restrictions</div><div>on the parser side. E.g. with Terrence's Java 1.5 grammar:</div><div><br></div><div>private boolean b = 3;</div><div><br></div><div>is totally valid.</div><div><br></div><div>I know that trying to catch violations in typing via the parser-grammar was a bad idea.</div><div>But I cannot come up with a good solution to do this in an extra stage via a TreeWalker.</div><div><br></div><div>Any help would be greatly appreciated.</div><div><br></div><div></div></body></html>