[il-antlr-interest: 22943] [antlr-interest] maven plugin thinks grammar is up-to-date

2009-04-01 Thread Pete Siemsen
I'm using the new ANTLR3 maven plugin described at http://www.antlr.org/antlr3-maven-plugin/ . Thanks to Jim Idle! The new plugin has a minor "feature" that the older plugin also had. If I edit my grammar and do "mvn package", maven doesn't detect that the grammar has changed. Maven says

[il-antlr-interest: 22942] Re: [antlr-interest] Handling wiki-style plain text with optional markup?

2009-04-01 Thread Laurent Caillette
What about chunking your input using some basic thing like a StringTokenizer, then parse each paragraph separately? Be aware that Wiki grammar is not a simple thing to parse. c. List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-i

[il-antlr-interest: 22941] Re: [antlr-interest] Antlrworks freezes

2009-04-01 Thread Devang Thakkar
Hi, Here is the Exceptions log and Stack Trace: Exception in thread "Thread-7" java.lang.OutOfMemoryError: Java heap space at java.util.HashMap.addEntry(HashMap.java:753) at java.util.HashMap.put(HashMap.java:385) at java.util.HashSet

[il-antlr-interest: 22940] Re: [antlr-interest] Handling wiki-style plain text with optional markup?

2009-04-01 Thread Peter Bertok
I'm still struggling to get this working. For example, a Wikipedia "title" looks like this: STARTOFLINE == title text == WHITESPACE? EOL There are a bunch of other control characters ('*', '<', etc...) as well that can go into a title string. I need to be able to parse this: ST

[il-antlr-interest: 22939] Re: [antlr-interest] Changing Token Names

2009-04-01 Thread Gavin Lambert
At 05:23 2/04/2009, Paul Bouché (NSN) wrote: >I am doing this: [...] > // kind of a hack because tokenNames is final > static { > tokenNames[OL] = "'['"; > tokenNames[CL] = "'['"; You might want to double-check CL, unless that was just an email typo. List: h

[il-antlr-interest: 22938] [antlr-interest] How to write a grammar to handle something similar to xml CDATA section?

2009-04-01 Thread Jack Pan
Hi, I have a language that can embed code snippet. For example the language can look like this: InvokeExternal("name"){ // the following code snippet will be send out If(continue){ DoSomething("test"); } } The idea is to treat everything inside the Invo

[il-antlr-interest: 22937] Re: [antlr-interest] Does the C runtime support token rewrite?

2009-04-01 Thread Jim Idle
Andy Grove wrote: > I am using a subset of the token rewrite in Java actions called from > the generated parser and I need to get the same functionality working > in C. The Java code is using the following methods from the > TokenRewriteStream class: > > public void insertAfter(int i, java.lang

[il-antlr-interest: 22936] [antlr-interest] Bug in Python Filter Lexers

2009-04-01 Thread Dave Dutcher
Hello, I am writing a lexer grammar with Antlr 3.1.3, and I've turned the filter option turned on and I'm targeting Python. I tried to set the text of a particular token calling self.setText in an action. The token I wanted to change is changed, but every token in the stream after that point is

[il-antlr-interest: 22935] [antlr-interest] Does the C runtime support token rewrite?

2009-04-01 Thread Andy Grove
I am using a subset of the token rewrite in Java actions called from the generated parser and I need to get the same functionality working in C. The Java code is using the following methods from the TokenRewriteStream class: public void insertAfter(int i, java.lang.Object o) public void rep

[il-antlr-interest: 22932] Re: [antlr-interest] TreeWalker to optimize AST under certain conditions

2009-04-01 Thread Jim Idle
Tilman Bender wrote: > Hi everybody, > > I am trying to make a simple compiler for a language that does simple > arithmetic expression and read/write operations. > I have a parser generating an AST. Now I would like to walk that AST > an alter/rewrite it by removing superflous subtrees. > > e.g:

[il-antlr-interest: 22931] Re: [antlr-interest] Question : Compiling generated parser code using C target with VC++

2009-04-01 Thread Jim Idle
wei@uni-konstanz.de wrote: > Dear all, > > we are using ANTLR3 (ver. 3.1.3) to generate a Java parser using C target. > The generated code is supposed to be compiled with Visual Studio 2008, and > later used in a VC++ project. > > The grammar file that we used is Java 1.5 grammar for ANTLR v

[il-antlr-interest: 22930] Re: [antlr-interest] Memory usage of nilNodes in the C target

2009-04-01 Thread Jim Idle
Richard Thrippleton wrote: Jim Idle wrote: This may well be a safe point that I missed and I will look at it, but I suspect it only works with your rule formulation. Thanks. It is not a good idea to use backtracking though unless your input is always guaranteed

[il-antlr-interest: 22929] [antlr-interest] TreeWalker to optimize AST under certain conditions

2009-04-01 Thread Tilman Bender
Hi everybody, I am trying to make a simple compiler for a language that does simple arithmetic expression and read/write operations. I have a parser generating an AST. Now I would like to walk that AST an alter/rewrite it by removing superflous subtrees. e.g: When I get a subtree for an addit

[il-antlr-interest: 22927] Re: [antlr-interest] Changing Token Names

2009-04-01 Thread Paul Bouché (NSN)
Jim Idle schrieb: > Paul Bouché (NSN) wrote: > >> Hi, >> >> I would like to change the token names for error display. >> >> I used have this: >> value : simpleValue | '{' property '}'; >> where a token type for the curly braces was created by ANTLR (T_XXX), >> but if it was missing then in the

[il-antlr-interest: 22926] Re: [antlr-interest] Memory usage of nilNodes in the C target

2009-04-01 Thread Richard Thrippleton
Jim Idle wrote: > This may well be a safe point that I missed and I will look at it, > but I suspect it only works with your rule formulation. Thanks. > It is not a good idea to use backtracking though unless your input is > always guaranteed to be correct, as otherwise the ability to give > good

[il-antlr-interest: 22925] [antlr-interest] Question: Compiling generated parser code using C target with VC++

2009-04-01 Thread Wei . Wei
Dear all, we are using ANTLR3 (ver. 3.1.3) to generate a Java parser using C target. The generated code is supposed to be compiled with Visual Studio 2008, and later used in a VC++ project. The grammar file that we used is Java 1.5 grammar for ANTLR v3 written by Terence Parr. We found it in

[il-antlr-interest: 22924] Re: [antlr-interest] Memory usage of nilNodes in the C target

2009-04-01 Thread Jim Idle
Richard Thrippleton wrote: > Preamble/warning; I'm, yet again, doing disturbing and possibly > undefined things with the C target ;-) > > The addition of the 'reuse' method on trees and the nilStack in the > arboretum helped memory usage quite a bit in my parser, but we were > still finding tha

[il-antlr-interest: 22923] Re: [antlr-interest] Changing Token Names

2009-04-01 Thread Jim Idle
Paul Bouché (NSN) wrote: > Hi, > > I would like to change the token names for error display. > > I used have this: > value : simpleValue | '{' property '}'; > where a token type for the curly braces was created by ANTLR (T_XXX), > but if it was missing then in the error message a '{' was generate

[il-antlr-interest: 22922] Re: [antlr-interest] Failure on OpenJDK on Debian

2009-04-01 Thread Ola Bini
Terence Parr wrote: > Hi Ola! Hmm...try -Xconversiontimeout 10 on antlr and see if > things change. > Lemme know. > T OK, doing this seems to have fixed it. The other weird thing is that the first compile after a pull seems to work - while the rest fails. Even when doing clean inbetween. Ve

[il-antlr-interest: 22921] Re: [antlr-interest] Failure on OpenJDK on Debian

2009-04-01 Thread Sam Barnett-Cormack
Gavin Lambert wrote: > At 00:02 2/04/2009, Sam Barnett-Cormack wrote: > >However, k=*, it'll do whatever lookahead is needed, so there > >isn't actually an ambiguity with LL(*). It would be silly to > >left-factor, say: > > > >EVERY : 'every'; > >EACH : 'each'; > >EVENT : 'event'; > > > >

[il-antlr-interest: 22920] Re: [antlr-interest] Failure on OpenJDK on Debian

2009-04-01 Thread Gavin Lambert
At 00:02 2/04/2009, Sam Barnett-Cormack wrote: >However, k=*, it'll do whatever lookahead is needed, so there >isn't actually an ambiguity with LL(*). It would be silly to >left-factor, say: > >EVERY : 'every'; >EACH : 'each'; >EVENT : 'event'; > >Because it just makes it unreadable. ANTL

[il-antlr-interest: 22919] Re: [antlr-interest] Antlrworks freezes

2009-04-01 Thread Johannes Luber
Devang Thakkar schrieb: > Nothing happens when I press Ctrl-Break. Start AW from the command prompt and press Crtl-Break (or Ctrl-C) in the command prompt window once AW has frozen. Johannes > > 2009/3/31 Terence Parr mailto:pa...@cs.usfca.edu>> > > Hi, can u print the stack trace when AW

[il-antlr-interest: 22917] Re: [antlr-interest] Failure on OpenJDK on Debian

2009-04-01 Thread Sam Barnett-Cormack
Gavin Lambert wrote: > At 09:45 1/04/2009, Ola Bini wrote: > >> Looks like your lexer rules are ambiguous (which probably > isn't > >> helped by the fact that you're also using literals in your > >> parser rules). > >> You should definitely consider correcting your rules so that > >> the amb

[il-antlr-interest: 22916] Re: [antlr-interest] Failure on OpenJDK on Debian

2009-04-01 Thread Gavin Lambert
At 09:45 1/04/2009, Ola Bini wrote: >> Looks like your lexer rules are ambiguous (which probably isn't >> helped by the fact that you're also using literals in your >> parser rules). >> You should definitely consider correcting your rules so that >> the ambiguity warnings go away; doing that

[il-antlr-interest: 22915] Re: [antlr-interest] Escaping single quotes in a lexer

2009-04-01 Thread Gavin Lambert
At 20:57 1/04/2009, Emanuele Gesuato wrote: >However i tried your solution, but i've got: > [antlr] ANTLR Parser Generator Version 2.7.6 (2005-12-22) >1989-2005 > [antlr] ..util/parser/SQL.g:54:30: This subrule cannot be >inverted. > Only subrules of the form: > [antlr]

[il-antlr-interest: 22914] [antlr-interest] Memory usage of nilNodes in the C target

2009-04-01 Thread Richard Thrippleton
Preamble/warning; I'm, yet again, doing disturbing and possibly undefined things with the C target ;-) The addition of the 'reuse' method on trees and the nilStack in the arboretum helped memory usage quite a bit in my parser, but we were still finding that an awful lot of memory was being tak

[il-antlr-interest: 22913] Re: [antlr-interest] how to best break apart multiple assignments

2009-04-01 Thread Sam Barnett-Cormack
Bruce Bauman wrote: > In the sometimes bizarre dialect of Pascal I am using (MetaWare), the > following is allowed: > > Odd := Even := 0; It's also worth noting that in many languages this isn't considered to be strange. You just evaluate the assignment operator right-to-left; the value of a

[il-antlr-interest: 22912] Re: [antlr-interest] Antlrworks freezes

2009-04-01 Thread Devang Thakkar
Nothing happens when I press Ctrl-Break. 2009/3/31 Terence Parr > Hi, can u print the stack trace when AW is frozen (CTRL-break on Windows I > think)? > Ter > > On Mar 31, 2009, at 10:52 AM, Devang Thakkar wrote: > > Hi, >> >> I am new to Antlr and AntlrWorks. >> >> I found that AntlrWorks fre

[il-antlr-interest: 22911] [antlr-interest] Changing Token Names

2009-04-01 Thread Paul Bouché (NSN)
Hi, I would like to change the token names for error display. I used have this: value : simpleValue | '{' property '}'; where a token type for the curly braces was created by ANTLR (T_XXX), but if it was missing then in the error message a '{' was generated because for that token in the Java t

[il-antlr-interest: 22910] Re: [antlr-interest] Handling wiki-style plain text with optional markup?

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

[il-antlr-interest: 22909] Re: [antlr-interest] how to best break apart multiple assignments

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

[il-antlr-interest: 22908] Re: [antlr-interest] Failure on OpenJDK on Debian

2009-04-01 Thread Ola Bini
Sam Barnett-Cormack wrote: > Ola Bini wrote: >> Gavin Lambert wrote: >>> At 02:44 1/04/2009, Ola Bini wrote: I have a grammar that works well with several different Java 5 and Java 6 environments on both Windows, Linux and MacOS X (including SoyLatte). But I've just got a bug repor

[il-antlr-interest: 22907] [antlr-interest] Handling wiki-style plain text with optional markup?

2009-04-01 Thread Peter Bertok
I'm working on a trivial embedded "wiki" style content management system for a web project, and I'm trying to design an ANTLR grammar for it, but I'm getting stuck. How does one write a grammar that can match a variety of rules, including things like nested brackets and the like, but if it can

[il-antlr-interest: 22906] Re: [antlr-interest] Escaping single quotes in a lexer

2009-04-01 Thread Emanuele Gesuato
Gavin Lambert wrote: > At 21:54 30/03/2009, Emanuele Gesuato wrote: > >What if i want to maintain as inalterate as possibile the original > >STRING ? > > > >STRING : "'"((JOLLY)?(PAROLE|INTEGER)(JOLLY)?)"'"; > > > >Is it possible to change it to something similar to > > > >STRING : "'"((JO

[il-antlr-interest: 22905] Re: [antlr-interest] reset method on a tree parser

2009-04-01 Thread Johannes Luber
Michael Bedward schrieb: > OK, a with a bit more delving I found the problem was caused by the > CommonTreeNodeStream stream being emptied after the first run of the > tree walker, so calling reset didn't achieve much. This differs from > ANTLR 3.1.1 behaviour but doesn't seem to be in the releas

[il-antlr-interest: 22904] Re: [antlr-interest] how to best break apart multiple assignments

2009-04-01 Thread Sam Barnett-Cormack
Bruce Bauman wrote: > In the sometimes bizarre dialect of Pascal I am using (MetaWare), the > following is allowed: > > Odd := Even := 0; > > I need to split this into: > > Odd := 0; > Even := 0; > > Can somebody point me in the right direction? I have a feeling it might be easier to bre

[il-antlr-interest: 22903] Re: [antlr-interest] Failure on OpenJDK on Debian

2009-04-01 Thread Sam Barnett-Cormack
Ola Bini wrote: > Gavin Lambert wrote: >> At 02:44 1/04/2009, Ola Bini wrote: >>> I have a grammar that works well with several different Java 5 and >>> Java 6 environments on both Windows, Linux and MacOS X (including >>> SoyLatte). But I've just got a bug report that it blows up on >>> OpenJDK