help me~~ Line break and indent the output AST treatment to know.

19 views
Skip to first unread message

booyeo...@gmail.com

unread,
Mar 28, 2014, 12:39:24 AM3/28/14
to antlr-di...@googlegroups.com

 

Good afternoon. Let us in the effort.
The closest antlr the hard work behind the concept is new to junginde looked improbable.

1. After you create the file, the following syntax to create an input string.
function aaa () {
     var a = 10.0, b = 4.0;
     var c = 10, d = 4;
     var e = a * b;
     var a = 5 + (4 * 6) && (5 + 3);
}

2. and has generated Lexer and Parser file tree shown below have been obtained.
miplatformRule_return oRtnParser = oMpScriptParser.miplatformRule ();
oMpScriptAST = (CommonTree) oRtnParser.getTree ();

3. bbbb aaa function names to AST in the output because after changing a single line appears below the results obtained uncomfortable.
function bbbb () {var a = 10.0, b = 4.0; var c = 10, d = 4; var e = a * b; var a = 5 + (4 * 6) && (5 + 3);}

Treated as an input string indext Let me know how to show the form.
 
*** I've attached the grammar file.

 

MpScript.g

Mike Lischke

unread,
Mar 28, 2014, 3:11:25 AM3/28/14
to antlr-di...@googlegroups.com

Good afternoon. Let us in the effort.
The closest antlr the hard work behind the concept is new to junginde looked improbable.

Syntax error on line 1: unexpected token 'in' at position 23
..
Syntax error on line 2: unexpected token 'antlr' at position 12.
..

Too many parse errors - giving up.

Let me guess, this is the result of an automatic translation? Not done with ANTLR I guess ;-)
Reply all
Reply to author
Forward
0 new messages