Questions tagged [tree-grammar]
The tree-grammar tag has no usage guidance.
18
questions
1
vote
1answer
55 views
Rascal: TrafoFields Syntax error: concrete syntax fragment
I'm trying to re-create Tijs' CurryOn16 example "TrafoFields" scraping the code from the video, but using the Java18.rsc grammar instead of his Java15.rsc. I've parsed the Example.java successfully in ...
0
votes
1answer
121 views
Weird “NoViableAltException” in Tree grammar with imaginary token
I can not understand a "NoViableAltException"exception when I compile my Tree grammar.
Here's a little piece of my grammar with the rule that gives me problems:
keyword_controls_sub
: ...
1
vote
1answer
58 views
ANTLR - Linking nodes of an AST
I want to know how can I define, in a grammar file, that a Node of an AST has "two parents". If for example, the node 'D' of the first tree is also child of the node 'A', what syntax should I use so ...
0
votes
1answer
139 views
Build POJO object from this Production Rule
I have rules of this format:
Condition -> Condition OPERATOR Condition | Condition
Condition -> attribute OPERATOR
value OPERATOR -> EQUALS | STARTS WITH | ENDS WITH | AND | OR | NOT ...
0
votes
1answer
292 views
copy nodes of trees using ANTLR tree grammars
I need some guidance on trying to solve a problem I ran across using tree grammars. Basically, I want to be able to do is replace/copy statements around that may be found in the tree. It is probably ...
0
votes
1answer
1k views
The following sets of rules are mutually left-recursive TREE GRAMMAR
I have a complete parser grammer than generates an AST which i could say is correct using the rewrite rules and tree operators. At the moment i am stuck at the phase of creating a tree grammar.I have ...
1
vote
1answer
809 views
Regular Expressions - tree grammar Antlr Java
I'm trying to write a program in ANTLR (Java) concerning simplifying regular expression. I have already written some code (grammar file contents below)
grammar Regexp_v7;
options{
language = Java;...
0
votes
0answers
96 views
How does one escape left/right braces in ANTLR3 header sections?
I have an ANTLR3 tree grammar with C as the target language. This tree grammar actually generates C++ objects and thus needs to include the header(s) for these classes. I use the @header section for ...
0
votes
1answer
551 views
node from line 0:0 mismatched tree node: UNIT expecting UNIT
What does this error mean? Notice it expected a UNIT node and got what it was expecting...
Phase_2.g: node from line 0:0 mismatched tree node: UNIT expecting UNIT
2
votes
1answer
1k views
ANTLR Parse Grammar -> Tree Grammar
Our last assignment for our compiler theory class has us creating a compiler for a small subset of Java (not MiniJava). Our prof gave us the option of using whatever tools we wish, and after a lot of ...
7
votes
1answer
2k views
Systematic way to generate ANTLR tree grammar?
I have a little bit large ANTLR parser grammar file and want to make a tree grammar for it. But, as far as I know this work of tree grammar generation can't be done automatically, i.e., I should ...
0
votes
1answer
2k views
ANTLR's tree-grammar AST graphical view
Im currently building a Javascript compiler in ANTLR and JAVA.
I use ANTLR's tree-grammar for generating ASTs. (Still in doubt whether this is smarter than a heterogeneous approach with a manually ...
4
votes
1answer
2k views
ANTLR's AST tree grammar + lists
I've have read a lot trying to find a way to cleanly consume lists in ANTLR's tree grammar. Here is what I have tried and their results (I really hope I'm missing something trivial)...
Using += ...
30
votes
5answers
22k views
How to parse Markdown in PHP?
First, I know, there already is a Markdown parser for PHP.
I also took a look to this question but it doesn't answer to my question.
Obviously, even if the title mention PHP, if it's language ...
1
vote
0answers
215 views
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 ...
1
vote
1answer
863 views
Dependency parsing
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 ...
3
votes
1answer
2k views
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=('!' | '-') ...
3
votes
2answers
3k views
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. ...