use SEMICOLON as deciding
factor :-)
That said this is only a hackish fix. I would prefer ANTLR using my own
predicates to decide when I have explicitly mentioned the predicate.
Is there an option to ask ANTLR to forcefully use my predicate when I have
specified one?
Cheers,
Indhu Bharathi
PS: I've
our predicate.
On Thu, Jan 1, 2009 at 4:34 PM, indhu bharathi wrote:
> This might not be an elegant fix. But it does fix the problem
> 13c13
> < : PROCEDURE IDENTIFIER SEMICOLON subroutineBlock SEMICOLON
> ---
> > : PROCEDURE IDENTIFIER SEMICOLON subroutin
Just curious. Why is parsing inside AntlrWorks (in debug) slower than
parsing using a java program? Is this because of displaying the graphical
parse tree or is there some other reason?
- Indhu
--~--~-~--~~~---~--~~
You received this message because you are
If you are not using single quote anywhere else in the grammar, you can try
this:
STRING
: SINGLEQUOTE ( options {greedy=false;} : . )* SINGLEQUOTE
;
If you are using single quote at other places also, then the problem becomes
little more complex.
In that case you have to
Hi,
When I parse an input in ANTLRWorks IDE, I can see which portion of the input
has errors using the 'input' window in the debugger. Syntax error (handled by
automatic error recovery) will be highlighted in red. While this is a very
useful feature, I cannot parse a very big file (approx 1 mb
Got it! I guess I can do that using
org.antlr.runtime.debug.DebugEventListener's beginResync (), endResync () &
consumeToken(Token t)
http://www.antlr.org/api/Java/interfaceorg_1_1antlr_1_1runtime_1_1debug_1_1_debug_event_listener.html
:-)
- Original Message -
Fr
'parseBinary' in Antlr examples folder might help you.
- Indhu
- Original Message -
From: j...@mentics.com
To: antlr-inter...@antlr.org
Sent: Friday, January 23, 2009 1:51:23 AM GMT+0530 Asia/Calcutta
Subject: [antlr-interest] Binary data
I have data that is mixed text and binary, so i
From: Indhu Bharathi
To: Ralf Düsedau
Cc: antlr-inter...@antlr.org
Sent: Tuesday, February 17, 2009 4:59:11 PM GMT+0530 Asia/Calcutta
Subject: Re: [antlr-interest] Editor using ANTLR-Parser
ANTLRWorks - http://www.antlr.org/works/index.html
- Original Message -
From: Ralf Düsedau
To:
ANTLRWorks - http://www.antlr.org/works/index.html
- Original Message -
From: Ralf Düsedau
To: antlr-inter...@antlr.org
Sent: Tuesday, February 17, 2009 4:36:29 PM GMT+0530 Asia/Calcutta
Subject: [antlr-interest] Editor using ANTLR-Parser
Hi there,
i'm new to ANTLR and my knowledge abo
Looks like you are trying to do things in Lexer that actually have to be
done in parser. Try keeping the bare minimum in Lexer and move other parsing
logics into Parser.
Can you post a small sample input you are trying to parse?
- Indhu
From: antlr-interest-boun...@antlr.org
[mailto:an
The following grammar will fix your problem.
---
grammar Test;
options {language=Java;}
foo : numeric DOT;
numeric :NUMBER (DOT NUMBER)?;
NUMBER : '0'..'9'+
;
DOT : '.'
;
t; and this comes to your
parser. But what your parser is expacting is NUMERIC followed by a '.'. So
parsing fails. Simple.
- Indhu
- Original Message -
From: Indhu Bharathi
To: Thomas Woelfle
Cc: antlr-inter...@antlr.org, j...@temporal-wave.com
Sent: Wednesday, February 18,
did not match anything at character ''
- Indhu
- Original Message -
From: Indhu Bharathi
To: Thomas Woelfle
Cc: antlr-inter...@antlr.org
Sent: Wednesday, February 18, 2009 2:32:49 PM GMT+0530 Asia/Calcutta
Subject: Re: [antlr-interest] Problem when parsing nume
I actually refer to the way how ANTLR decides which token has to be generated
next. The simplest case would be that one has a NUMBER rule, a DOT rule and a
FLOGTING_POINT rule. With the input "1." ANTLR could theoritically create a
NUMBER token followed by a DOT token, but just tries to match F
A quick guess:
Green:
It was parsed since you had ‘backtrack’ option set and the
parse was success. It will however be parsed again in black color.
Red:
It was parsed since you had ‘backtrack’ option set but the
parse was failure.
- Indhu
From:
attribute_type
: 'unsigned long long'
| 'unsigned long'
;
Though you have written 'unsigned long long' and 'unsigned long' in the parser
rule, they will be still considered as lexer rule only.
The lexer after seeing 'unsigned long' will try to go for the bigger match
('unsigned l
Hi,
I'm attaching a debug listener to my parser and overriding
'recognitionException' method as shown below.
public void recognitionException (RecognitionException e) {
System.err.println(e);
}
But I see that the error message printed is not as good as what is printed in
stderr when the
>it's no longer possible to alter the content of a token away from what's on
>the input at all.
I'm not sure if this is right. I still do token.setText(...) in my actions and
I'm using ANTLR 3.1.1.
Just a guess... Maybe you have to use TokenRewriteStream instead of the regular
CommonTokenStr
method in your parser with the
exception.
Ter
On Feb 26, 2009, at 8:28 AM, Indhu Bharathi wrote:
> Hi,
>
> I'm attaching a debug listener to my parser and overriding
> 'recognitionException' method as shown below.
>
> public void recognition
Hi,
Suppose I want to do something like this
methodDecl : scope t=returnType ident LRAPEN RPAREN
{
insertBefore(t,
"something");
or
ind any example out there for this requirement. Can anybody
explain a little more clear. Sorry if there is some simple way to do it and
I'm not getting it.
- Indhu
-Original Message-
From: Terence Parr [mailto:pa...@cs.usfca.edu]
Sent: Friday, February 27, 2009 2:53 AM
To: Indh
{
input.insertBefore(pos, "inserted");
}
;
a : 'a'
;
b : 'b'
;
Let me know if there is a better or more elegant way to do this. But I'm fine
with this :-)
Thanks, Indhu
- Original Mes
To: indh...@s7software.com
Cc: antlr-interest
Subject: Re: [antlr-interest] Rewriting in non tree grammar
On Feb 27, 2009, at 12:43 AM, Indhu Bharathi wrote:
> Figured it out :-) Here is a sample grammar that does what is
> required:
>
> grammar Test;
>
> @mem
Got it. What I missed is the '$' symbol while referencing
I wrote:
r : t=a b a
{
... t.start.getTokenIndex() ...
}
It must have been
r : t=a b a
{
... $t.start.getTokenIndex() ...
}
Thanks :-)
- Original Message -
From: Terence Parr
To: Indhu Bharathi
This sometime happens due to bug in the grammar. Try running debugger with some
very simple grammar. If it works, then the mistake is with the grammar.
- Indhu
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@antlr.org] On Behalf Of Filipe David Manana
Sent: Sunday, M
Hi,
Is there a way to separate grammar and actions into two different files?
This will be helpful when multiple people are working with the same grammar
file (each might write their own actions for the same production) and don't
want to create redundant copies of the grammar file.
One way I
%21+Tree+pattern+matching%2C+rewriting+a+reality
. This sounds damn sexy! But has this been released? Does the latest release
(3.1.2) include this?
Thanks, Indhu
- Original Message -
From: Sam Harwell
To: Indhu Bharathi , antlr-inter...@antlr.org
Sent: Thursday, March 5, 2009 8:34:25
grammar SqlSQL2Parser;
options {
superClass=DmlSQL2Parser;
}
- Indhu
- Original Message -
From: Maciej Gawinecki
To: ANTLR Interest Mailing List
Sent: Tuesday, March 10, 2009 12:29:52 PM GMT+0530 Asia/Calcutta
Subject: [antlr-interest] grammar inheritance
Hi,
Jim Idle said that
Try this:
Today: ( (Today_) => 'Today' ) ;
fragment Today_
: 'Today'
;
However, I'm not sure if this's the most elegant way to fix it.
Read the following thread to understand more on why exactly this happens:
http://www.antlr.org/pipermail/antlr-interest/2009-February/032959.html
- Indh
Hi,
Is it not possible to pass an instance of RuleReturnScope as argument to a
function? With the following sample, I get the error message 'missing attribute
access on rule scope'. Curious to know the reason for this limitation... or am
I missing something? Is there a workaround?
foo : bar1
Hi,
The problem is because ',' or '=' is not defined anywhere in the lexer rule. To
be able to lex an input completely, it is necessary that the lexer grammar must
account for every character that can occur in the input and be able to convert
it into tokens. If you dont want to intoduce these
an error state without noticing that a
> different token arrangement would keep it in the green.
>
>
> Mihai
>
> On Tue, Mar 10, 2009 at 3:48 AM, Indhu Bharathi
> mailto:indh...@s7software.com>> wrote:
>
> Try this:
>
> Today: ( (Today_) => '
grammar Test;
expr : (ID {System.out.println( $ID.text );} )*
;
ID : 'a'..'z'+
;
WS : (' ' | '\t' | '\n')+ {$channel = HIDDEN;}
;
- Indhu
william yuan wrote:
> Hi ,
> problem like this ,
> i ve defined a grammar like this
> expr: ID*;
> ID:('a'..'z')*;
> and my input is
> ABC DEF
> so how c
Maybe you are looking for something like this:
attributes
:attribute+
;
attribute
:typeAttr
|lengthAttr
|pathAttr
;
Here is a complete sample:
grammar Test;
attributes
:attribute+
;
attribu
is not present");
}
}
:attribute+
;
typeAttr:'TYPE' ID ';'
{
$attributes::typeAttrSeen = true;
}
;
- Indhu
Indhu Bharathi wrote:
> Maybe you are looking for something like this:
>
> attributes
>
Looks like you are trying to use keyword as identifier. AFAIK, this
cannot be resolved in the lexer. You have to use predicates in the
parser rule. Something like this:
rule : keyKEYWORD1 (keyKEYWORD2 enc=Name)? ';' ;
keyKEYWORD1
:{input.LT(1).getText().equals("keyword1")}? Name ;
keyK
lems you mentioned are eliminated.
>
> As I can see your proposed solution is not scalable if I have the
> keywords: keywordA, keywordB,...,keywordZ, and the Name rules: Name1,
> Name2,..., NameN. Or is it?
>
> Any solution for this?
>
>
> Regards,
> Gabriel
>
>
a function called "function" in the namespace that has
> the prefix "declare". This function takes the parameter "declare" of
> type XML element having the tag name "declare", and returns also an
> XML element having the tag name "function"
This will work:
variableStatement
: VAR? variableDeclaration ( COMMA m=variableDeclaration )* semic
{tokens.replace($m.start, $m.end, "something else");} &n bsp;
;
$m will be of type variableDeclaration_return which will be subclass of
'ParserRuleReturnScope'. $m is not Token.
- Indhu
YINGAnn
There was a typo in my mail. It is $m.stop and not $m.end. Sorry :-)
And here is the documentation:
http://www.antlr.org/api/Java/classorg_1_1antlr_1_1runtime_1_1_parser_rule_return_scope.html
:-)
YINGAnnie wrote:
>
>
> Well, I tried it,but this timethe error is :
> java.lang.NullPointerExceptio
Maybe 'm=variableDeclaration' didn't match anything in the input...
YINGAnnie wrote:
>
>
> Sorry ,Iforgot to mention, Icorrected $m.end.
>
> Now, I am using {tokens.replace($m.start, $m.stop, "something else");}
>
> but I got java.lang.NullPointerException error.
>
> It seems $m is null.
>
>
> An
Are you sure 'tokens' is the TokenRewriteStream? Generally in the
generated code the member variable 'input' is the token stream. Maybe
you have to write 'input.replace($m.start, $m.stop, "something else");'
unless you have done something to change the name of the token stream.
Also note that 'inp
Can 'dfa.predict' throw 'no viable alternative' exception? I'm facing
this strange problem and wondering what could be the reason. Any pointers?
Thanks, Indhu
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email
Jim Idle wrote:
> Andreas Meyer wrote:
>> David Jameson schrieb:
>>
>>> I have the following grammar fragment
>>>
>>> refTag :
>>> LSQUARE a=expression (COMMA b=expression)? RSQUARE
>>> {
>>> //stuff
>>>
>>> } ->
How about something like this?
r:(ID EQ)+ INTLIT SEMICOLON -> ^(ASSIGN ID INTLIT)+
;
So, for your example, this will create two subtrees with ASSIGN as root.
The tree generated will be ^(nil ^(ASSIGN Odd 0) ^(ASSIGN Even 0))
And then you can write string template in the tree walker
Take a look at 'filter' mode of ANTLR lexer. This will let you skip text
you are not interested in.
Posting a more specific example of what you need might help.
Peter Bertok wrote:
>
>
>
> I'm working on a trivial embedded "wiki" style content management
> system for a web project, and I'm tr
Hi,
It looks like memoize at rule level doesn't work in composite grammar. I
get the error message '! memo array is null for ParserPart.g'.
'state.ruleMemo' is always null.
Also, it looks like this is a known issue. Has this been fixed or is
there a workaround?
I tried turning on mem
n Behalf Of Indhu Bharathi
Sent: Thursday, April 02, 2009 10:58 PM
To: antlr-interest
Subject: [antlr-interest] Composite grammar and memoize
Hi,
It looks like memoize at rule level doesn't work in composite grammar. I
get the error message '! memo array is null for ParserPart.g&
I don't have ANTLR right now to test this. But guess it would work
NEWLINE: '\r'?'\n' {$channel = HIDDEN;};
Then write expression_statement rule like this:
expression_statement
:expression { NewLineBeforeNextToken( input.LT(1) ) }?=> /*nothing*/
;
And in the @
l pass whereas "foo" will fail :-)
I casted input to 'DebugTokenStream' since I was running inside
ANTLRWorks. You can cast it to CommonTokenStream.
Cheers, Indhu
Indhu Bharathi wrote:
>
> I don't have ANTLR right now to test this. But guess it would
'expression' is rule 'r' wont return a Token since it is not a lexer rule. It
will instead return 'ParserRuleReturnScope' since it is a parser rule. So
'$expression.stop' or '$t.stop' will give you the last token of 'expr'. You can
use it like shown below:
r : t=expression { newLineBeforeNextT
I was working in a big grammar and stumbled on a problem with
predicates. I've simplified the problem as much as possible and here it is:
When I give the input "1.", I expect the tokens . But what
I get is "No viable alternative at character 'EOF'. I'm not able to
understand why this happens.
Hi,
Any clue why this doesn't work? I'm still clueless.
- Indhu
Indhu Bharathi wrote:
> I was working in a big grammar and stumbled on a problem with
> predicates. I've simplified the problem as much as possible and here it is:
>
> When I give the input "1.&
LIT; }
;
DOT:'.'
;
fragment PATTERN
:;
fragment FLOAT_LIT
:;
fragment INT_LIT
:;
fragment
NUMBER:('0'..'9')+
;
fragment
LETTER:'a'..'z'
;
Thanks, Indhu
Jim Idle
At 03:12 9/04/2009, Indhu Bharathi wrote:
>> INT_FLOAT_PATTERN
>> :(NUMBER DOT NUMBER LETTER ) => NUMBER DOT NUMBER LETTER
>> { $type=PATTERN; }
>>
>> |( NUMBER DOT NUMBER ) => NUMBER DOT NUMBER
>> { $type=FLOAT_LIT; }
Use '@members' to store 'global' variables.
like
@members{
int cnt;
}
and increase 'cnt' in 'species' production, like
species
: ret=atom NUMBER?
{
cnt += $ret.weight * Integer.parseInt($NUMBER.text)
}
;
and print out the sum in file production, like
file
WS: (' ' | '\n' | '\r' )+ {$channel=HIDDEN};
This should give you compile error. There must be a ';' immediately
after 'HIDDEN'. ( {$channel=HIDDEN;} )
Are you using tab instead of space in input?
David Cournapeau wrote:
> Hi,
>
> I have started using antlr to catch up my lack of knowledge in
Curious. Why not change formula production to
formula
: EQ expression
| expression
;
If for some reason you want to enforce that the input has to start with PLUS
or MINUS then maybe you can rewrite formula production as
formula
: EQ expression
| (PLUS | MINUS)=> expression
;
Thi
gt; being entered, so I have to accomodate it.
>
> I have a rough solution which is to Pre-parse the text and then change
> the text to "=-5+4" and then pass the new text to the second parser,
> but I was wondering if there is a more elegant solution
>
> Than
how would I pass the whole expression to
> "expression"?
>
> Thanks
> Des
>
>
>
> 2009/4/10 Indhu Bharathi <mailto:indh...@s7software.com>>
>
> Well, in that case the second solution that uses syntactic
> predicate should work.
>
>
This is expected behavior only. It is designed this way so that user can
filter for a particular channel if needed. For your task, you can use
getTokens() method which will return a List of tokens that can be iterated.
Cheers, Indhu
Chris Lambrou wrote:
> Yesterday I was stung by some odd behav
Order doesn't matter. ANTLR will match the longest possible token.
One case when order matters is when the rule below cannot match any
token inspite of the 'lengthiest token matching' mechanism.
Example:
ID : 'a'..''z'+ ;
SOME_KEYWORD : 'key' ;
In this case ANTLR will report an err
It is true that the parser can 'tune' to any channel. But you can't do
it while parsing. The channel should be set before parsing begins.
If you want to see the off channel token while parsing, you can use LA(
int ) and LT( int ) within the parser.
For your example, you can write something li
Did you evaluate the option of making semicolon a default token itself instead
of hidden token? Unless there is compelling reason to make semicolon hidden
token, let's make it default token. That will make the work easy.
Now assuming there is some compelling reason to make semicolon hidden toke
Looks like a lot of work that has to be done in the lexer is getting
done in the parser. I would prefer tokenizing '[%"Dear "%]' as a
separate token and similarly '[% name %]' as a separate token.
Simple substring, trim operations can get you the actual block and
string content later.
Here i
Looks like you are parsing with empty input. What is the input you gave
to the parser?
Cheers, Indhu
Marwan Ajraoui wrote:
> Hi there;
>
> I'm getting a strange error form a parser. I have defined a grammar,
> wich contains these rules;
>
>
> decl_codigo : decl_libreria decl_program
>
> decl_l
This is because on seeing 'f' of foo lexer has two options - 1. IDENT
2. URL. And it takes the second options since that seems to be longer
that the first alternative. Note that the lexer always tries to match
the longest token possible.
After having decided to go for URL, it matches the inpu
You get the error because 'SELECT' will match everything in the input
till EOF greedily (because of .+) and obviously WS cannot match
anything. When you use .+, you have to turn off greedy. Try something
like:
TEXT : SELECT ( options {greedy=false;} : . )* FROM
This should work:
Two methods of parser (mismatch and recoverFromMismatchedSet) are responsible
for auto-recovery and showing error messages.
If you want to throw an exception and exit right on the first error you need to
override these methods and just throw the exception instead of handling it.
Something like
Ah, forgot. Things changed after the book was written. I guess you have to
override the following two methods from BaseRecognizer
void recover (IntStream input, RecognitionException re)
Object recoverFromMismatchedSet (IntStream input, RecognitionException e,
BitSet follow) throws RecognitionE
Overwride the emit method and check 'getCharPositionInLine' for the tokens
emited. If the value is zero emit an additional BOL token. This will take
care of beginning of file too.
Something like this:
java.util.LinkedList tokenQueue = new java.util.LinkedList();
public void emit(Token token)
For your second and third question, solution is to use 'composite grammar'.
You'll be able to extend the existing grammar file. You can also form a
grammar by combining multiple .g files. One file might contain the lexer and
the parser itself could be spread across multiple grammar files. There is
That is an expected behavior. Seeing ' C' the lexer decides to go for 'CORP'
token instead of OTHER(space) and WORD. You need to do some left factoring
there. Or you can modify your grammar to avoid such problems. Here is a
suggested correction:
grammar Test ;
test1 : NUMBER CORP data {System.ou
By default error recovery is turned on and ANTLR will try to recover from
syntax errors. However it will print error message on stderr.
If you need error recovery to be turned off and throw an exception at the
first sight of an error, you need to override 'recoverFromMismatchedToken'
as shown in
STRING
: '"' ( options {greedy=false;} : . )* '"'
;
Greedy is turned off so that .* doesn't consume the terminating '"' also.
Cheers, Indhu
-Original Message-
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@antlr.org] On Behalf Of Xiaohua Guo
Sent: Thursday, June 0
I don't get any exception. BTW, it is good to match the entire 'phrase' as
one token in the lexical analysis itself. Something like:
PHRASE :( '0'..'9' | 'A'..'Z' | ' ' | '\t')+ ;
and modify stmt to:
stmt :SUBJ_TOK COLON PHRASE NL+ ;
Else, you'll end up creating too man
SL_COMMENT_2
: '--' (options {greedy=false;} : . )* '\n' {$channel=HIDDEN;}
{
setText( "//" + getText().substring(2) );
}
;
Should work.
-Original Message-
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@antlr.org]
ANTLRWORKS accepts tab in input box without any problem. The version I'm
using is 1.2.3
-Original Message-
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@antlr.org] On Behalf Of Dukie Banderjee
Sent: Tuesday, June 09, 2009 12:45 AM
To: antlr-inter...@antlr.org
Subj
As stated in the link you provided, there is nothing you have to do to get
this functionality. But 'identifier' should be a lexer rule. I guess your
grammar should be something like this:
APPLY : 'apply';
BROWSE : 'browse'
.
ID
Maybe you can use a setter to set what 'ifKeyword' is and use that in a
semantic predicate.
Something like:
@members {
String ifKeyword;
Public void setIfKeyword(String str) {
this.ifKeyword = str;
}
}
ifKeyword
: { LT(1).getText().equals(i
What exactly is the error message you get?
On Sep 4, 2009, at 12:57 PM, Klaus Martinschitz wrote:
> Hi!
>
> I already looked around in the internet and do not find any answer to
> solve following problem. I downloaded the newest antlr works version
> 1.2.3 were antlr and antlr works are bundle
I guess you can do it with composite grammars.
-Original Message-
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@antlr.org] On Behalf Of Martin Potier
Sent: Wednesday, September 09, 2009 7:10 PM
To: antlr-inter...@antlr.org
Subject: [antlr-interest] Grammar inclusio
Yes, backtracking will affect performance. If you are concerned about
performance, don't use backtrack and try left factoring your grammar
instead.
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@antlr.org] On Behalf Of Bharath R
Sent: Thursday, September 10, 2009 5:25 PM
dissemination) by persons other than the
intended
recipient(s) is prohibited. If you receive this e-mail in error, please
notify the sender by
phone or email immediately and delete it!
_
From: Indhu Bharathi [mailto:indh...@s7software.com]
Sent: Thursday, September 10, 2009 10:37 PM
T
A related mail from archive:
you mean a parse tree, not AST, right? There is a ParseTreeBuilder i think.
T
On Sep 1, 2009, at 12:50 PM, Stefan Groschupf wrote:
> Hi,
> I'm making my first baby with antlr.
> Is there any chance to get a AST exactly as antlr work is generating
> wit
Try using semantic predicates to look-ahead and decide whether to emit
SLCOMMENT or TEMPLATE
Something like:
fragment SLCOMMENT
: ;
fragment TEMPLATE
: ;
SLCOMMENT_OR_TEMPLATE
: '//' (
Check if you are creating the lexer/parser under the right
directories. Look like the files are getting generated at root level
in source tree.
On Sep 19, 2009, at 9:28 AM, Sailesh Kandula wrote:
> While building my first ANTLR project SimpleCalc.g i ran into the
> error:
>
> The declare
You can do something like
ID : LETTER (LETTER|DIGIT)*
{
String text = getText();
Integer tknType;
if( (tknType=table.get(text))!=null ) {
$type = tknType;
}
}
The table can be passed to t
'!' is a rewrite operator used in tree construction. Since lexer doesn't
construction a tree, I don't think this will work.
-Original Message-
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@antlr.org] On Behalf Of Gordon Tyler
Sent: Thursday, September 24, 2009 6:5
I don't think if any tool exists to do it automatically. But the generator
adds the grammar also as comments into the generated lexer/parser. You can
manually go through it and recover the grammar.
-Original Message-
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@a
Try the tool 'strip'. It comes with ANTLR.
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@antlr.org] On Behalf Of Jonathan Claggett
Sent: Tuesday, September 29, 2009 3:41 AM
To: antlr-inter...@antlr.org
Subject: [antlr-interest] StringTemplate to generate Grammar docs?
Is it possible to write a separate program to break the PGN files into
separate games and pass each game to the lexer/parser? That will be a simple
solution assuming there is an easy way to split games in a PGN file.
-Original Message-
From: antlr-interest-boun...@antlr.org
[mailto:antlr
Try something like:
(a)=> ((b)=>/*nothing*/ | a)
I remember facing similar problem. I guess you can't use '~' in a syntactic
predicate.
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@antlr.org] On Behalf Of Naveen Chawla
Sent: Monday, October 05, 2009 7:32 PM
T
ANTLRWORKS already has this feature. Compile your grammar in ANTLRWORKS.
When there is an ambiguity, the rule will be marked in red and you can check
the "Syntax diagram" tab to graphically see the ambiguity.
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@antlr.org] On
In that case you have to use syntactic predicate.
Cheers, Indhu
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@antlr.org] On Behalf Of Naveen Chawla
Sent: Wednesday, October 07, 2009 4:33 AM
To: antlr-inter...@antlr.org
Subject: Re: [antlr-interest] Help writing a par
Try something like
r : lbl=searchTerm ({spaceFollows($lbl.stop)}?=> lbl=searchTerm)*
;
@members {
public boolean spaceFollows(Token tkn) {
return input.get(tkn.getTokenIndex()+1).getType()==WS;
}
}
Cheers,
Indhu Bharathi
&l
Refer 'composite grammar' from wiki.
http://www.antlr.org/wiki/display/ANTLR3/Composite+Grammars
Cheers,
Indhu Bharathi
<http://www.s7software.com/> S7 Software Solutions
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@antlr.org] On Beha
Can you post a small sample where the problem exists?
-Original Message-
From: antlr-interest-boun...@antlr.org
[mailto:antlr-interest-boun...@antlr.org] On Behalf Of Martin Potier
Sent: Monday, October 12, 2009 5:44 PM
To: antlr-inter...@antlr.org
Subject: [antlr-interest] [LEXER] U
our problem, I’m not sure if this is an
elegant way of fixing this problem. I would vote for parser checking only
the syntax and the symantics handled by tree walkers. You can establish the
relation between messages while tree walking.
Cheers,
Indhu Bharathi
<http://www.s7software.co
AFAIK, there is no shortcut.
You will have to write something like
HELLO : ( ('H'|'h') ('E'|'e') ('L'|'l') ('L'|'l') ('O'|'o') )
;
You can make it more readable using fragments.
HELLO : H E L L O
fragment H: ('H'|'h')
fragment E: ('E'|'e')
fragment L: ('L'|'l')
fragment O:
1 - 100 of 116 matches
Mail list logo