[il-antlr-interest: 23055] Re: [antlr-interest] ANTLRWorks Decision DFA

2009-04-09 Thread Aaron Leiby
And of course the instant I hit send, I figure it out. Never fail. At least it'll be documented here. 1) Select 'Highlight Decision DFA' from the Grammar menu. 2) Click on one of the highlighted characters. 3) Wait one second for a warning icon to pop up. 4) Click on warning icon to get 'Show De

[il-antlr-interest: 23056] [antlr-interest] discrepancy between antlrworks and antlr generated parser

2009-04-09 Thread David Cournapeau
Hi, I have started using antlr to catch up my lack of knowledge in parsers. This is a great product, thanks a lot ! I am trying to create my own DSL, and started very simply with parsing the following name: foo; But got a problem while using antlworks. I get space-related problem: name:foo; -

[il-antlr-interest: 23057] Re: [antlr-interest] discrepancy between antlrworks and antlr generated parser

2009-04-09 Thread Indhu Bharathi
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

[il-antlr-interest: 23058] Re: [antlr-interest] discrepancy between antlrworks and antlr generated parser

2009-04-09 Thread Gavin Lambert
At 19:10 9/04/2009, Indhu Bharathi wrote: >WS: (' ' | '\n' | '\r' )+ {$channel=HIDDEN}; > >This should give you compile error. There must be a ';' >immediately after 'HIDDEN'. ( {$channel=HIDDEN;} ) Python doesn't require semicolon statement terminators, does it? If not, then what the OP ha

[il-antlr-interest: 23059] [antlr-interest] Building syntax highlighters with ANTLR

2009-04-09 Thread Sam Harwell
I've made a few posts about this in the past, and it looks like another one is on the way. I designed a new, much easier, robust, and general way to make a syntax highlighter from a grammar, and it even allows clean "stacking" of lexers. As a quick example, my primary grammar recognizes a block com

[il-antlr-interest: 23060] Re: [antlr-interest] discrepancy between antlrworks and antlr generated parser

2009-04-09 Thread David Cournapeau
On Thu, Apr 9, 2009 at 5:20 PM, Gavin Lambert wrote: > At 19:10 9/04/2009, Indhu Bharathi wrote: >>WS: (' ' | '\n' | '\r' )+ {$channel=HIDDEN}; >> >>This should give you compile error. There must be a ';' >>immediately after 'HIDDEN'. ( {$channel=HIDDEN;} ) > > Python doesn't require semicolon sta

[il-antlr-interest: 23061] Sexy model crushes breasts after starring Young Schoolgirls first Teen Foto webcamgirl Shooting! private view of me in the form of pictures and videos !!

2009-04-09 Thread tegargarg
Sexy model crushes breasts after starring Young Schoolgirls first Teen Foto webcamgirl Shooting! private view of me in the form of pictures and videos !! access to 1000’s of LIVE SEXY uncensored adult viewing of Home Based Webcams! http://www.budurl.com/rpyf If you are at least 18 yrs. old, enter

[il-antlr-interest: 23063] Re: [antlr-interest] simple arithmetic counter

2009-04-09 Thread Tobias Wunner
Thanks a lot for all this Info! Everything worked. Regards, Toby On Apr 9, 2009, at 6:23 AM, Indhu Bharathi wrote: > Use '@members' to store 'global' variables. > > like > @members{ > int cnt; > } > > and increase 'cnt' in 'species' production, like > > species > : ret=atom NUMBER? >

[il-antlr-interest: 23064] Re: [antlr-interest] discrepancy between antlrworks and antlr generated parser

2009-04-09 Thread Gavin Lambert
At 20:56 9/04/2009, David Cournapeau wrote: >> Python doesn't require semicolon statement terminators, does it? > >no, it does not (but adding the semicolon made it work). I did not >know the above was supposed to be python code. In general, anything within {} is target language code (stat

[il-antlr-interest: 23062] Re: [antlr-interest] recursive rule invocations

2009-04-09 Thread Bowen Alpern
Aaron Leiby wrote: Everyone's favorite error! I'm playing with a subset of the javascript language, but am having difficulties building a grammar in ANTLR for it. I've pared down one of my core problems to the following subset: expression : Name (invo

[il-antlr-interest: 23065] [antlr-interest] Implicit Typecasting with a tree grammar

2009-04-09 Thread Tilman Bender
Hi there, I am still playing with my interpreter for arithmetic expressions. Now I would like to work with mixed expressions containing integer and floating point numbers. When doing so I would like to have the integers automatically "uppercasted" when they occur in an expression together wit

[il-antlr-interest: 23066] [antlr-interest] Help with infix expression evaluator grammar

2009-04-09 Thread Christopher Schultz
ANTLR folks, I've been using a grammar for years to evaluate infix mathematical expressions with function calls and things like that. It has performed beautifully. I recently noticed that some (meaningless) junk at the end of the expression was sometimes ignored. For example, this expression shou

[il-antlr-interest: 23067] Re: [antlr-interest] Help with infix expression evaluator grammar

2009-04-09 Thread Jim Idle
Christopher Schultz wrote: > ANTLR folks, > > > It seems like the most logical fix is to create a new top-level > production that just says: > > return=expr (EOF!) > > ...and remove the EOF entirely from my 'expr' production. > Yes - that is the correct way to handle that. Jim List: http://w

[il-antlr-interest: 23068] Re: [antlr-interest] Help with infix expression evaluator grammar

2009-04-09 Thread Christopher Schultz
Jim, On 4/9/2009 11:43 AM, Jim Idle wrote: > Christopher Schultz wrote: >> ANTLR folks, >> >> >> It seems like the most logical fix is to create a new top-level >> production that just says: >> >> return=expr (EOF!) >> >> ...and remove the EOF entirely from my 'expr' production. >> > Yes - tha

[il-antlr-interest: 23069] ECMAScript 3 Grammar - Missing ELSE?

2009-04-09 Thread shambolic
I'm looking at the ECMAScript 3 grammar referenced in the grammars download section on ANTLR.org but located at http://research.xebic.com/es3/. I don't know how to get the else part of an if/else out of the tree walker. In the grammar that constructs the tree, the ifStatement rule looks like thi

[il-antlr-interest: 23070] Re: [antlr-interest] Building syntax highlighters with ANTLR

2009-04-09 Thread Terence Parr
Let's hear the details, Sam! :) Ter On Apr 9, 2009, at 1:38 AM, Sam Harwell wrote: > I’ve made a few posts about this in the past, and it looks like > another one is on the way. I designed a new, much easier, robust, > and general way to make a syntax highlighter from a grammar, and it > ev

[il-antlr-interest: 23071] StringTemplate ListDictionary iteration

2009-04-09 Thread Todd Stout
I'm trying to iterate over a ListDictionary (C# StringTemplate) in a template and have each list item invoke another template: DataDefAssign(cols) := << , type=) }> >> The above template does not generate anything. If I inline an anonymous template instead of trying to invoke the PropDef template

[il-antlr-interest: 23073] [antlr-interest] Inject Lexer Tokens before parsing further

2009-04-09 Thread Des Hartman
I have two ways of entering an expression to evaluate: 1) =-5+4 2) -5+4 I have written the usual expression evaluator that evaluates the expression as per 1) above to -1. The problem lies with the second form of input. Since the parser recognises the "=" OR the "-" as the start of an expression, i

[il-antlr-interest: 23074] Re: ECMAScript 3 Grammar - Missing ELSE?

2009-04-09 Thread shambolic
What I've done to fix this is the following in the parser: // $ ^( IF expression $if_block ^( ELSE $else_block )? ) ; And the following in the tree walker: ifStatement : ^( IF expression statement ^( ELSE statement? ) ) ; On Apr 9, 10:13 am, shambo...@gmail.com wrote

[il-antlr-interest: 23076] Re: [antlr-interest] Inject Lexer Tokens before parsing further

2009-04-09 Thread Indhu Bharathi
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

[il-antlr-interest: 23077] Re: [antlr-interest] Inject Lexer Tokens before parsing further

2009-04-09 Thread Des Hartman
Indhu This is based on how users enter formulas in Excel. It allows you to prefix a formula with "=", "-" or "+" to indicate it is a formula 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

[il-antlr-interest: 23078] Re: [antlr-interest] Inject Lexer Tokens before parsing further

2009-04-09 Thread Indhu Bharathi
Well, in that case the second solution that uses syntactic predicate should work. Des Hartman wrote: > Indhu > > This is based on how users enter formulas in Excel. It allows you to > prefix a formula with "=", "-" or "+" to indicate it is a formula > being entered, so I have to accomodate it.

[il-antlr-interest: 23079] Re: [antlr-interest] Inject Lexer Tokens before parsing further

2009-04-09 Thread Des Hartman
Not sure how that would help. If I select the second option because the recognised Token is "-", how would I pass the whole expression to "expression"? Thanks Des 2009/4/10 Indhu Bharathi > Well, in that case the second solution that uses syntactic predicate > should work. > > > Des Hartman

[il-antlr-interest: 23080] Re: [antlr-interest] Inject Lexer Tokens before parsing further

2009-04-09 Thread Indhu Bharathi
Because the syntactic predicate will look ahead without consuming the token. PLUS or MINUS will still be unconsumed and can later be consumed by expression. Des Hartman wrote: > Not sure how that would help. If I select the second option because > the recognised Token is "-", how would I pass t

[il-antlr-interest: 23081] Re: [antlr-interest] Inject Lexer Tokens before parsing further

2009-04-09 Thread Des Hartman
ah, ok, I understand. I'll have a look at it then. Thanks for the help Thanks Des 2009/4/10 Indhu Bharathi > Because the syntactic predicate will look ahead without consuming the > token. PLUS or MINUS will still be unconsumed and can later be consumed by > expression. > > > Des Hartman wro

[il-antlr-interest: 23083] Re: [antlr-interest] Collecting Values in Lists

2009-04-09 Thread Michael Bedward
Hi Behdad, I'm sorry - I didn't read your question properly. Here is an example that might be more relevant... grammar Test; x returns [List values] @init { $values = new ArrayList(); } : e=y {$values.add($e.value)} (',' e=y {$values.add($e.value)} )* ; y returns [int va