[il-antlr-interest: 26777] Re: [antlr-interest] The idea of semantic analyzer generator

2009-11-10 Thread John B. Brodie
Greetings! On Tue, 2009-11-10 at 23:27 +0300, GreyAx wrote: > I'm looking for topics to investigate in part of my master thesis. I'm > interesting in verification, > static code analysis and so on. I have an idea, which I want to implement and > integrate with ANTLR, > please give me any feedba

[il-antlr-interest: 26510] Re: [antlr-interest] Nested multi-line comments

2009-10-25 Thread John B. Brodie
On Sun, 2009-10-25 at 01:03 +0100, Peter Boughton wrote: > Thanks John, but this doesn't appear to be working. > (I'm using antlr 3.2 with antlrworks 1.3) > > I tried it both as provided and with changing the comment start/end > characters, and both of these give the same error in the generated >

[il-antlr-interest: 26496] Re: [antlr-interest] Nested multi-line comments

2009-10-24 Thread John B. Brodie
Greetings! On Sat, 2009-10-24 at 17:40 +0100, Peter Boughton wrote: > How do I support nested comments with ANTLR? > This is what I use: // multiple-line comments ML_COMMENT : NESTED_COMMENTARY { $channel=HIDDEN; } ; fragment NESTED_COMMENTARY : '/*' ( options {greedy=false;} : . )

[il-antlr-interest: 26331] Re: [antlr-interest] Bug or misunderstanding?: missing attribute access on rule scope

2009-10-16 Thread John B. Brodie
Greetings! Sorry about this message, I think I have broken any threading to the original message. I am replying from the mail-list archive and seem to be unable to figure out how to graft my reply into its proper thread. Sorry. On Fri Oct 16 12:21:33 PDT 2009, Kaleb Pederson asked: > I'm getting

[il-antlr-interest: 26268] Re: [antlr-interest] AST rewrite infinite loop

2009-10-14 Thread John B. Brodie
Greetings! On Wed, 2009-10-14 at 16:15 -0400, Bill Andersen wrote: > FYI, all. The problem described does NOT occur without rewrite = true > Isn't rewrite = true for Tree grammars only? -- your rule below looks like a Parser rule to me - altho can't really tell for sure... > On Oct 14, 2009, a

[il-antlr-interest: 26068] Re: [antlr-interest] Older Grammar in ANTLR 3

2009-10-03 Thread John B. Brodie
Greetings! On Sat, 2009-10-03 at 18:24 -0400, Pennington, Elliot wrote: > Howdy All, > > I've got an old grammar that used to work in ANTLR 2 but that now > fails in ANTLR 3. I'd like to make the switch, but I'm at a loss as to > how to fix this. For the following example code: > > -

[il-antlr-interest: 25998] Re: [antlr-interest] how to get the value of an identifier

2009-09-29 Thread John B. Brodie
Greetings! On Tue, 2009-09-29 at 16:54 +0200, Thierry USO wrote: > A complete example which shows my problem. > remainder snipped Your grammar does not handle New-Line characters ('\n' and possibly '\r'). You should have received many "no viable alternative at ..." error messages

[il-antlr-interest: 25894] Re: [antlr-interest] Question with greedy

2009-09-23 Thread John B. Brodie
Greetings! On Wed, 2009-09-23 at 23:35 +0200, Andreas Volz wrote: > Hello, > > I wrote this grammar: > > startrule > : (property comment property)* > ; > comment > : COMMENT { printf("Comment: \%s\n", $COMMENT.text->chars); } > ; > > COMMENT > : '/*' ( opti

[il-antlr-interest: 25710] Re: [antlr-interest] Looking for reference to how ANTLR performs ... special example will not work???

2009-09-11 Thread John B. Brodie
Greetings! On Fri, 2009-09-11 at 10:20 -0400, Sylvain, Gregory [USA] wrote: > Great replies thank you, I was assumed the longest-match wins rules > applied, but I wasn't sure - thanks. > > Here is an example of the sort of problems I am trying to figure out. > > > r: 'BEGIN/' f1

[il-antlr-interest: 25681] Re: [antlr-interest] Rule automation

2009-09-09 Thread John B. Brodie
Greetings! On Wed, 2009-09-09 at 10:45 +0200, Martin Potier wrote: > I've got something on my mind that the Definitive ANTLR Reference > couldn't solve (yet, I'm not tottally through it). > Is there a way with ANTLR v3 to automate some rule ? > > Id est, while building a small wiki language I wr

[il-antlr-interest: 25429] Re: [antlr-interest] parse tree construction

2009-08-25 Thread John B. Brodie
Greetings! Martijn's suggestions are close but need a couple of tweaks, see below... On Tue, 2009-08-25 at 18:50 +0200, Martijn Reuvers wrote: > Hi Safiye, > > As Sam said, recursion might be what you need. > > Something like this gives your tree I believe: > > grammar test; > > options { >

[il-antlr-interest: 25270] Re: [antlr-interest] Simple Grammar breaks ANTLRWorks Interpreter & Debugger?

2009-08-16 Thread John B. Brodie
Greetings! On Sun, 2009-08-16 at 18:25 -0600, consili...@gmail.com wrote: > I looked at ANTLRStringStreams consume() method and noticed that it > checks for a '\n'. In the current grammar I'm skip()ing newlines, > instead of placing them on a hidden channel. > > I made the following modificati

[il-antlr-interest: 24754] Re: [antlr-interest] Can never be matched

2009-07-19 Thread John B. Brodie
On Sun, 2009-07-19 at 12:10 -0700, Bryan S Follins wrote: > I'm almost done with a lesson grammar but I ran into a problem I get an > error referencing the TOKEN RULE, which is on Line 17 (TOKEN : ID) It also > references Line 20, where there is a blank before SEPERATOR. > > The error reads

[il-antlr-interest: 24751] Re: [antlr-interest] rewriting tree such that children are at same level

2009-07-19 Thread John B. Brodie
Greetings! On Sun, 2009-07-19 at 21:02 +0300, hakan eryargi wrote: > well, i know both trees evaluate to same result, but i want it this > way for human readability. this will be used for defining requirments > and later will be presented in a gui. and i guess it's easier to debug > this way.. >

[il-antlr-interest: 24490] Re: [antlr-interest] Question about preserving spaces in quoted strings

2009-07-02 Thread John B. Brodie
Greetings! On Thu, 2009-07-02 at 10:35 -0400, Penningroth, Mark wrote: > I have the following in my grammar: > > sqcon > : '\'' ( options {greedy=false;} : .)* '\'' > ; > > The intent is to get a single text node with everything between the > sing quotes. > > When I parse ‘Los Angeles’

[il-antlr-interest: 24410] Re: [antlr-interest] Look-ahead problem parsing phrase?

2009-06-28 Thread John B. Brodie
Greetings! On Sun, 2009-06-28 at 16:04 -0700, Sean O'Dell wrote: > Thanks for the help Gavin. > > Let me see if I understand this correctly; I'm trying to get my head > down into this. > > On "top-level lexer rules should not refer to other top-level lexer > rules": What constitutes a "top-lev

[il-antlr-interest: 24241] Re: [antlr-interest] Matching empty string

2009-06-15 Thread John B. Brodie
Greetings! On Sun, 2009-06-14 at 23:09 -0400, Dukie Banderjee wrote: > Hi, > My grammar needs to handle the following situation: A line can have > multiple fields, separated by a delimiter. A field can have multiple > components, separated by another delimiter. > If a field or component is blank,

[il-antlr-interest: 24010] Re: [antlr-interest] Whats wrong with this?

2009-06-03 Thread John B. Brodie
Greetings! On Wednesday 03 June 2009 06:14:26 pm Mats Ekberg wrote: > I cant figure out why this grammar dont work (I have left out some > not relevant stuff). > This expression works:[ LOOKUP( A1234567890, 9TN ) ] 93 > This dont:[ LOOKUP( A1234567890, ATN ) ] 93 > Why? Your lexer rules f

[il-antlr-interest: 23860] Re: [antlr-interest] Excluding words as tokens

2009-05-22 Thread John B. Brodie
Greetings! On Friday 22 May 2009 05:07:55 am schlp...@gmx.ch wrote: > I'm trying to write a grammar to check the correctness of package names in > respect to our meta modell. Thereby I ran into to following problems: > > ABSTRACTOBJECT: > SERVICEOBJECT | QUERYOBJECT > > SERVICEOBJECT: UPPERCASE

[il-antlr-interest: 23690] Re: [antlr-interest] Ambiguities or resolving the rules

2009-05-13 Thread John B. Brodie
Greetings! On Wednesday 13 May 2009 01:43:06 am Bharath R wrote: > Hi All ,, Good morning. > I m very new to ANTLR , I m facing a below problme like the second rule is > getting matched with the first rule and its not able to be parsed. > > This is my grammar > > grammar tel; > > TEL : T E L COLON

[il-antlr-interest: 23430] Re: [antlr-interest] Weird problem with semantic predicates. Incorrect warning message

2009-04-29 Thread John B. Brodie
On Tuesday 28 April 2009 05:08:08 pm Gabriel Petrovay wrote: > 1. warning(200): exit_test.g:9:3: Decision can match input such as > "IF" using multiple alternatives: 1, 3 > > The IF does not MATCH the first alternative, therefore, the warning is > NOT correct. I assume by now you have taken Jim's

[il-antlr-interest: 23404] Re: [antlr-interest] Weird problem with semantic predicates. Incorrect warning message

2009-04-28 Thread John B. Brodie
Greetings! On Tuesday 28 April 2009 08:10:43 am Gabriel Petrovay wrote: > Hi all, > > I have the parser grammar posted at the bottom of this e-mail. (there > is a corresponding lexer grammar that provides all the necessary > tokens). > > If I try to build the parser for this grammar, I get the fo

[il-antlr-interest: 22957] Re: [antlr-interest] Lexer not pulling in fragments?

2009-04-02 Thread John B. Brodie
On Thursday 02 April 2009 10:27:27 am Jim Idle wrote: > Joseph Klumpp wrote: > > I'm trying to create tokens for the guards of C header files (with > > filter=true), e.g. '#define __hello_h_' => > __hello_h_>, and have the following rules defined: > > > > GUARD : '#' LETTER+ WS+ IDPART

[il-antlr-interest: 22208] Re: [antlr-interest] Disabling look ahead or ???

2009-03-02 Thread John B. Brodie
Greetings! On Monday 02 March 2009 10:51:20 am Paul Bouché (NSN) wrote: > I have the following grammer, problem described below. > start : outerPropertynode | EOF; > outerPropertynode : outerProperties; > properties : (property delim)*; // simplified > property : key '=' value; > value

[il-antlr-interest: 21609] Re: [antlr-interest] expression list in tree grammar

2009-01-28 Thread John B. Brodie
Micheal Bedward asked: > In my parser grammar: > > expr_list       : (expr (',' expr)* )? -> ^(EXPR_LIST expr*) ; > > In my tree grammar: > > expr_list returns [List values] : ^(EXPR_LIST expr*) >                   { $values = new ArrayList(); >                     int n = $EXPR_LIST.getChildCount(

[il-antlr-interest: 21591] Re: [antlr-interest] The behavior.....

2009-01-27 Thread John B. Brodie
Meena Vinod asked: > I have a new problem now. My application's .g is as follows: > >     CMD_CD : 'cd'; >     CMD_SHOW: 'show'; >     CMD_RESET: 'reset'; >     CMD_SET: 'set'; >     CMD_OPTION: (' -all' | ' -help' | ' -version' | ' -display')*; >     TSEP: ' ' { SKIP(); }; > > The parser is define

[il-antlr-interest: 21065] Re: [antlr-interest] antlr: beginner question...

2008-12-22 Thread John B. Brodie
> Started using antlr this weekend...so please bear my lack of understanding > ( i did buy terence's book and am on page 70... )... > > I wrote my first grammar...cut & paste from terence's java grammar...a > subset just to handle if-else statements... > > When I generate java from this ( using ant

[il-antlr-interest: 20591] Re: [antlr-interest] Lexer rule with alternatives (Newbie question)

2008-11-22 Thread John B. Brodie
for the input "t+1", I have the error: > line 1:4 mismatched input '+' > works for me. no errors reported. using the attached test rig under ANTLR v3.1, August 12, 2008. > But when I switch "OPER" to "oper", All work as it should. I don't > unde

[il-antlr-interest: 20588] Re: [antlr-interest] Lexer rule with alternatives (Newbie question)

2008-11-22 Thread John B. Brodie
> Hello, Greetings! > why such grammar doesn't work properly: > --- >--- expr: >         operand ((oper) operand)* ^^ I assume you mean the lexer rule OPER here? >         ; > //Cor

[il-antlr-interest: 20437] Re: [antlr-interest] Listing order of NT alternatives on rhs of production appears to affect "accept/reject" of parser for fixed input.

2008-11-11 Thread John B. Brodie
Dejas Ninethousand wrote: > Hello, Greetings! > I believe I have found a peculiar issue in ANTLR.  If memory serves, the > order of alternatives in a grammar should have no effect on the set of > inputs it accepts.  For example I believe: > > program : statement_list | expression > > is equivalen

[il-antlr-interest: 20418] Re: [antlr-interest] Why does syntactic predicate not take effect?

2008-11-10 Thread John B. Brodie
Britta Kiera wrote: > Don't know if the first reply was sent. Trying it a second time. > > > At 23:32 10/11/2008, Britta Kiera wrote: > > >The lexer was supposed to generate a NAMES token for the feature > > >name sequence. The definition below shows an approach that I tried > > >to accomplish this

[il-antlr-interest: 20238] Re: [antlr-interest] Debugging: how? (Why do I get MismatchedTokenException or UnwantedTokenException?) Unhelpful error messages.

2008-10-30 Thread John B. Brodie
>...snipped >> .. but I still have no solution to my > problem: how can I make the variable in my label rule be anything?  That > is, I would think anything except whitespace and braces and control > characters would be fine.  In particular, it definitely has to accept > any word in any scr

[il-antlr-interest: 20188] Re: [antlr-interest] Debugging: how? (Why do I get MismatchedTokenException or UnwantedTokenException?) Unhelpful error messages.

2008-10-28 Thread John B. Brodie
Greetings! Hendrik Maryns asked: > I showed you my grammar yesterday.  Now trying it out on some simple > inputs blows me away right away: it doesn’t even parse anything. Your problem seems to be with your Lexer rule for LABEL which is : LABEL : ~(')')+ ; this means that any sequence of charact

[il-antlr-interest: 19809] Re: [antlr-interest] THE STEAMROLLER PROBLEM!

2008-10-02 Thread John B. Brodie
On Thursday 02 October 2008 09:43:44 pm Randall R Schulz wrote: > Hi, > > Sorry for shouting, but I really would like a definitive answer to this > question. ("Steamroller" referring to creating a flat AST.) > > If one is to parse an infix operator notation, exemplified by this > input: > > 1

[il-antlr-interest: 19808] Re: [antlr-interest] your Or ast question

2008-10-02 Thread John B. Brodie
On Thursday 02 October 2008 09:34:11 pm Randall R Schulz wrote: > On Thursday 02 October 2008 17:54, you wrote: > > Mr. Schulz :- > > I'm sorry. My father isn't here right now... I happen to believe that everyone deserves respect... > > Sorry for this disconnected reply to your last message to m

[il-antlr-interest: 19799] Re: [antlr-interest] Rewriting to Flat Tree Nodes for Associative Multiary Operators

2008-10-02 Thread John B. Brodie
Greetings! On Thursday 02 October 2008 05:23:09 pm Randall R Schulz wrote: > How might I alter a rule such as this one: > > op790Formula >     :   (op780Formula -> op780Formula) >         ( >             Or rDisjunct = op790Formula >         ->  ^(Or $op790Formula $rDisjunct) >         ) ? >    

[il-antlr-interest: 19482] Re: [antlr-interest] how to generate parser code from .g file?

2008-09-11 Thread John B. Brodie
On Thursday 11 September 2008 09:32:11 pm Yixun Liu wrote: > I want to generate parser code from .g file. How to do it? at your favorite shell (batch) prompt enter: java org.antlr.Tool your_grammar_filename_goes_here.g Hope this helps -- -jbb List: http://www.antlr.org:8080/mailman/listinf

[il-antlr-interest: 19446] Re: [antlr-interest] lexer: matching float vs int

2008-09-09 Thread John B. Brodie
Greetings! On Tuesday 09 September 2008 12:19:30 pm Olya Krachina wrote: > I still get the same error, even with your suggestion. > > Quoting Chris Rebert <[EMAIL PROTECTED]>: > > I think you might need to left-factor here. > > Have you tried: > > > > FLOAT: INT? '.' INT; ...snipped... > > On Sep

[il-antlr-interest: 19381] Re: [antlr-interest] Simple parsing question

2008-09-05 Thread John B. Brodie
Greetings! On Friday 05 September 2008 10:58:35 pm George J. Shannon wrote: > Attached is a snippet of the grammar in question, where tagCommentNbr is > the integer value enclosed in brackets that I referred to in my email post. > George > > tagCommentElement returns [ParserTagCommentElement pTag