Hi, I love replying to myself ;-) I found some way of achieving the implicit uppercast, but not using a tree grammar. I wrote my grammar to distinguish between int and float expressions right from the start. Unfortunately I now run into trouble. I added boolean expressions to my grammar and cannot find a way to make boolean _expression_ like: bool a := 3<4 work, but prevent my grammar from accepting things like bool a:=4 which is obviously bad. So I had a look at the Java grammars on antlr.org and found that, they do not impose type restrictions on the parser side. E.g. with Terrence's Java 1.5 grammar: private boolean b = 3; is totally valid. I know that trying to catch violations in typing via the parser-grammar was a bad idea. But I cannot come up with a good solution to do this in an extra stage via a TreeWalker. Any help would be greatly appreciated. |
Arith.g
Description: Binary data
Arith.testsuite
Description: Binary data
Am 09.04.2009 um 13:35 schrieb Tilman Bender:
|
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address