tree-grammar

ANTLR - Writing a tree grammar for an AST

I have an AST outputted for some Lua code by my grammar file, which currently does parsing and lexing for me. I want to add a tree grammar to this, but since i'm using C# i'm not sure how to do it. What's the basic process for generating tree grammar code when you already have a parser and lexer written? UPDATE: I have the following gra...

ANTLR 3.x - How to format rewrite rules

I'm finding myself challenged on how to properly format rewrite rules when certain conditions occur in the original rule. What is the appropriate way to rewrite this: unaryExpression: op=('!' | '-') t=term -> ^(UNARY_EXPR $op $t) Antlr doesn't seem to like me branding anything in parenthesis with a label and "op=" fails. Also, I've...

Dependency parsing

Hi I particularly like the transduce feature offered by agfl in their EP4IR http://www.agfl.cs.ru.nl/EP4IR/english.html The download page is here: http://www.agfl.cs.ru.nl/download.html Is there any way i can make use of this in a c# program? Do I need to convert classes to c#? Thanks :) ...

Antlr grammar: declaring the grammatical context

I've been looking at: http://www.antlr.org/wiki/display/~admin/2008/04/11/Rewrite+rules There is the section on grammatical context that says: [classDef var]: // context is "field" type ID -> blort [... method var]: // context is "local" type ID -> blech which as I understand is a way for you to look at the past non-terminals t...

ANTLR, lack of method in C# target

I generated the C# code from tree grammar using ANTLR and I cannot find the method downup(). Is the sequence of calls: topdown(); bottomup(); equivalent to downup() method? Why the method does exist in Java but not in C#? And why do they (the authors) advise to override the following methods: protected override void Topdown() { topdo...