I tried that approach when I first started with ANTLR but had difficulty
handling arbitrary token rearrangement. Early on I couldn't figure out how
to backtrack in the token stream in order to detect identifier construction
using macros. Something like the following requires that 'prefix' be lexed
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
il-antlr-interest group.
To post to this group, send email to
Hi James,
In this case, I'm dealing with semantic predicates of the form {...}? and
gated semantic predicates of the form {...}?=. The ones you're using in
this case are syntactic predicates, which aren't processed by the Boolean
logic algorithm I've been working on recently.
Sam
-Original
I have the lexing, parsing and tree rewriting completed and will now be
doing a proof of concept for the next phase to see if StringTemplates will
work as expected. This will be my first use of StringTemplates. Since ST4 is
so new and is not documented in the books, should I start with ST3 or jump
ST4 is *tremendously* faster than ST3 and includes the most useful debugger
for any template engine I've seen to date. For a new application, it's not
even a question IMO - definitely ST4.
Sam
-Original Message-
From: antlr-interest-boun...@antlr.org
On Tue, Apr 5, 2011 at 11:01 AM, Sam Harwell sharw...@pixelminegames.comwrote:
ST4 is *tremendously* faster than ST3 and includes the most useful debugger
for any template engine I've seen to date. For a new application, it's not
even a question IMO - definitely ST4.
Sam
Thanks,
Eric
Hello list,
I currently have a grammar that looks something like this:
//this is the root
public prog
: globalStmt+
;
globalStmt: stateDef;
stateDef
: 'state' ID stateBlock;
stateBlock
: '{' stateBlockContent* '}'
;
stateBlockContent
: NEWLINE!
;
This is enough to demonstrate the
This is enough to demonstrate the problem. When I create a program such as:
state hello
{
}
}
The trailing close bracket is not detected as an error.
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
Try to anchor it by adding an EOF at the end of your entry-rule:
Thank you Bart!
That of course did the trick. I dont know why I didnt think of that.
I appreciate the quick response, have a nice week!
--
David Daeschler
On Tue, Apr 5, 2011 at 2:31 PM, Bart Kiers bki...@gmail.com wrote:
This is enough to demonstrate the problem. When I create a program
The AST operators are the most efficient manner:
localVariableDeclaration
: LOCAL^ variableDeclarationList
;
variableDeclarationList
: variableDcl ( ','! variableDcl )*
;
Or use rewrites:
localVariableDeclaration
: LOCAL variableDeclarationList - ^(LOCAL
Hi Graham
Does this give you what you want ?
localVariableDeclaration
: LOCAL! variableDeclarationList
;
variableDeclarationList
: variableDcl ( ',' variableDcl )* - ^(LOCAL variableDcl)+
;
If you also use the variableDeclarationList rule for non-local
declarations you could give
Problem solved. Thanks for the replies, the parameterized version does
exactly what I need:
localVariableDeclaration:
: LOCAL! variableDeclarationList[LOCAL]
;
variableDeclarationList[int type]
: variableDcl ( ',' variableDcl )*
- {type == LOCAL}? ^(LOCAL variableDcl)+
- //
Hello,
I personally prefer a manual tree-visitor (which walks the AST), that
way you can just evaluate a node and based on the result take
appropriate action, it also allows more control (e.g. multi-phases if
needed). The main reason I do it that way is I don't want any of my
grammars getting
13 matches
Mail list logo