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

2009-04-02 Thread Wei . Wei
Dear Jim, this is very helpful. Thank you! Best regards, Wei On Wed, 1 Apr 2009, Jim Idle wrote: > 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 Stud

[il-antlr-interest: 22945] [antlr-interest] Looping forever on some input

2009-04-02 Thread Ola Bini
Hi, I'm having some trouble with the lexer looping forever on input that should be possible to disambiguate in limited time. Not exactly sure why this happens. It is definitely possible I have done something stupid in my grammar, of course. I've seen eternal looping before, for some construct

[il-antlr-interest: 22946] Re: [antlr-interest] Looping forever on some input

2009-04-02 Thread Thomas Brandon
The problem is most likely your DecimalLiteral rule: DecimalLiteral : ; Non-fragment lexer rules that can match no input will cause infinite loops. This may only occur for certain input as other input will be matched before ANTLR checks whether the troublesome rule can match. Having input

[il-antlr-interest: 22947] Re: [antlr-interest] Looping forever on some input

2009-04-02 Thread Ola Bini
Thomas Brandon wrote: > The problem is most likely your DecimalLiteral rule: > DecimalLiteral > : > ; > Non-fragment lexer rules that can match no input will cause infinite loops. > This may only occur for certain input as other input will be matched > before ANTLR checks whether the troub

[il-antlr-interest: 22948] [antlr-interest] Building translators for MSIL

2009-04-02 Thread jevitha
Hi, Im a newbie to ANTLR. Im trying to build a translator from Microsoft Intermediate Language (MSIL) to another intermediate language which is used by one of the libraries which i wanted to use in my research project. Currently i have the Grammar for MSIL (source language) and JIMPLE (Target L

[il-antlr-interest: 22949] Re: [antlr-interest] Looping forever on some input

2009-04-02 Thread Ola Bini
Thomas Brandon wrote: > The problem is most likely your DecimalLiteral rule: > DecimalLiteral > : > ; > Non-fragment lexer rules that can match no input will cause infinite loops. > This may only occur for certain input as other input will be matched > before ANTLR checks whether the troub

[il-antlr-interest: 22950] Re: [antlr-interest] Looping forever on some input

2009-04-02 Thread Ola Bini
Thomas Brandon wrote: > The problem is most likely your DecimalLiteral rule: > DecimalLiteral > : > ; > Non-fragment lexer rules that can match no input will cause infinite loops. > This may only occur for certain input as other input will be matched > before ANTLR checks whether the troub

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

2009-04-02 Thread Andreas Meyer
Hi! When opening my (big) grammar in AntlrWorks, I usually tell java to use as much memory as possible, such as (from commandline) $ java -Xmx1g -jar antlrworks.jar Maybe the different look&feel implementations have different memory usage patterns, so one look&feel runs out of memory earlier

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

2009-04-02 Thread Joseph Klumpp
I'm trying to create tokens for the guards of C header files (with filter=true), e.g. '#define __hello_h_' => , and have the following rules defined: GUARD : '#' LETTER+ WS+ IDPART '_'; ID : IDPART; WS : (' ' | '\n')+ {$channel = HIDDEN;}; fragment IDPART :

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

2009-04-02 Thread Jim Idle
Pete Siemsen wrote: > 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

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

2009-04-02 Thread Jim Idle
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 '_'; > ID: IDPART; > > WS: (' ' | '\n')+ {$chann

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

2009-04-02 Thread Jim Idle
Jim Idle wrote: 2. Is there a way to set the value of token GUARD to be just the IDPART portion of the lexem? GUARD : '#' LETTER+ WS idp=IDPART '_' { $text = $idp.text; } // Should work ; Sorry - not enough tea yet - this shoudl be: GUARD   :   '#' LE

[il-antlr-interest: 22956] [antlr-interest] Representations of AST

2009-04-02 Thread Alexander Brown
Hi, Perhaps this will sound like a rather stupid question, but I am wondering if there is a better way to approach the problem I am trying to solve. I am interested in parsing SQL. I have developed a grammar based on the (overly complex) SQL2003 specification for my corpus (something like 1G

[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: 22958] Re: [antlr-interest] Lexer not pulling in fragments?

2009-04-02 Thread Joseph Klumpp
Thanks John and Jim - the explanation of IDPART needing two interpretations (underscore vs. no underscore) makes perfect sense and explains why hoisting the rule in works. Also, setText works like a charm. John, you're correct about guards like __GUARD_H_ being only a programming convention, but I

[il-antlr-interest: 22959] [antlr-interest] GUnit: NPE on JUnitCodeGeneration

2009-04-02 Thread Tilman Bender
Hi folks,Tried to setup a testsuite for my tree grammar. The testsuite can be run (allthough all tests fail) via the normal org.antlr.gunit.Interp command butwhen I try to generate JUnit-Code for it I get an NPE: java -cp ../../../target/classes/:$CLASSPATH org.antlr.gunit.Interp -o Optimizer.tests

[il-antlr-interest: 22960] Re: [antlr-interest] GUnit: NPE on JUnitCodeGeneration

2009-04-02 Thread Leon Su
Hi Tilman, Thanks for the bug report and the testing grammars. I'll check this issue later today. Regards, Leon On Thursday, April 02, 2009, at 09:28AM, "Tilman Bender" wrote: >Hi folks, > >Tried to setup a testsuite for my tree grammar. The testsuite can be >run (allthough all tests fail)

[il-antlr-interest: 22961] [antlr-interest] Composite grammar and memoize

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

[il-antlr-interest: 22962] [antlr-interest] ANTLR Grammar for SELECT statement

2009-04-02 Thread Ramakrishnan Venkataramani
Hello, I am new to ANTLR. I am looking for a very simple SQL statement like SELECT and INSERT written in ANTLR grammar. I am also looking for the corresponding lexer, parser, and the test file (which reads the lexer, parser files and produces output). I saw the grammar *for PL/SQL* http://www.antl

[il-antlr-interest: 22963] Re: [antlr-interest] ANTLR Grammar for SELECT statement

2009-04-02 Thread Sam Barnett-Cormack
Ramakrishnan Venkataramani wrote: > Hello, > I am new to ANTLR. I am looking for a very simple SQL statement like > SELECT and INSERT written in ANTLR grammar. I am also looking for the > corresponding lexer, parser, and the test file (which reads the lexer, > parser files and produces output).

[il-antlr-interest: 22964] Re: [antlr-interest] Representations of AST

2009-04-02 Thread Andy Tripp
Alexander, The crux of what I say here: http://www.jazillian.com/articles/treewalkers.html is that as the amount of logic needed in your treewalker grows, the ANTLR treewalker doesn't really help. You start off with a few simple actions triggered at various points of treewalking, but then it grow

[il-antlr-interest: 22965] Re: [antlr-interest] Representations of AST

2009-04-02 Thread Foust
Wow, Andy. So well-said. Both about the difficulty of parsing C/C++ and the state of tree walkers. It's so easy to shoot yourself in the foot using Antlr. It can simplify the initial design when you're still figuring out what you want to do, but as the codebase grows, you can be thinking it's re

[il-antlr-interest: 22966] Re: [antlr-interest] Representations of AST

2009-04-02 Thread Sam Barnett-Cormack
Foust wrote: > Wow, Andy. So well-said. > > Both about the difficulty of parsing C/C++ and the state of tree walkers. > It's so easy to shoot yourself in the foot using Antlr. It can simplify the > initial design when you're still figuring out what you want to do, but as > the codebase grows, yo

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

2009-04-02 Thread Terence Parr
I think antlr has a weird bug that forgets to give timeout error. T On Apr 1, 2009, at 7:40 AM, Ola Bini wrote: > 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

[il-antlr-interest: 22970] Re: [antlr-interest] Building translators for MSIL

2009-04-02 Thread Loring Craymer
Jevitha-- Take a look at the papers on converting Java byte code to JIMPLE (referenced in the wikipedia article; also look at http://www.sable.mcgill.ca/soot/); that will give you a handle on the analysis pass(es) you need to go through to map data representations.  Once you have mapped data re

[il-antlr-interest: 22971] Re: [antlr-interest] GUnit: NPE on JUnitCodeGeneration

2009-04-02 Thread Leon Su
Hi Tilman, The main reason of the NPE is due to a syntax error in your Optimizer.testsuite in which you should use "{tree-rule} walks {rule}:" for defining the test target (tree grammar's rules). Try to modify "expr:" to "expr walks expr:" in your testsuite, and it should work. You can also re

[il-antlr-interest: 22972] Re: [antlr-interest] GUnit: NPE on JUnitCodeGeneration

2009-04-02 Thread Tilman Bender
Hi Leon, Augh! How could I be that blind. I also misinterpreted the "walks" keyword as I thought adding it to the heading of the testsuite would suffice. Thank you very much for you help and keep on the good work with GUnit! Tilman Bender Student des Software Engineering Hochschule Heilbronn

[il-antlr-interest: 22973] [antlr-interest] How to throw an exception for all parsing errors?

2009-04-02 Thread Peter C. Chapin
Hello! I'm working with the C# target. I'm writing test cases for my parser. I try to parse a collection of input files to verify that they all parse as expected (later I'll probably also verify that erronous input fails to parse, but that's for another day). I'm trying to use NUnit to manage th

[il-antlr-interest: 22974] Re: [antlr-interest] ANTLR Grammar for SELECT statement

2009-04-02 Thread Alexander Brown
Unless you are parsing a set of very very simple statments then the short answer is no. There is no such thing as a simple grammar that can parse SELECT and INSERT statements. The complexity is that practically anywhere you can have a simple identifier (like a column name), you can have a comp

[il-antlr-interest: 22975] Re: [antlr-interest] Composite grammar and memoize

2009-04-02 Thread Indhu Bharathi
Hi, I guess this is the problem Ter talks about in this mail: http://marc.info/?l=antlr-dev&m=121174142722552&w=2 Wondering if this bug is fixed or is still there... - Indhu -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of

[il-antlr-interest: 22976] [antlr-interest] A Simple Question on Channels

2009-04-02 Thread Andreas Stefik
Hello list, I am an academic working on a new compiler architecture. I've written a number of compilers in the past in other languages, including JavaCC and Lex/Yacc, and am pretty well versed in compiler theory, and thought that it might be fun and interesting to try out ANTLR. As such, I've writ

[il-antlr-interest: 22977] Re: [antlr-interest] A Simple Question on Channels

2009-04-02 Thread Andreas Stefik
Woops, I suppose I didn't say it. My target language is Java. Andreas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-interest@googlegroups.com

[il-antlr-interest: 22978] Re: [antlr-interest] A Simple Question on Channels

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

[il-antlr-interest: 22979] [antlr-interest] 3.1.4 + C runtime: Imaginary tokens lost their names?

2009-04-02 Thread Gary R. Van Sickle
Here's a new one: My imaginary tokens aren't getting printable names now unless I explicitly set them via a rule like this: struct_or_union_specifier : [...whatever...] | lc='struct' IDENTIFIER -> ^(STRUCT[$lc, "STRUCT"] IDENTIFIER) If in my calling program I do this:

[il-antlr-interest: 22980] Re: [antlr-interest] A Simple Question on Channels

2009-04-02 Thread Indhu Bharathi
As expected, there were some bugs :-) Here is a implementation that works fine: grammar Test; @members{ private boolean newLineBeforeNextToken( int index ) { Token tkn; input = (DebugTokenStream) input; while( inp