[il-antlr-interest: 27245] [antlr-interest] Is it possible to pass input without using a ANTLR stream? - UPDATED

2009-12-13 Thread Asha Ramegowda
Hi, I am aware that antlr input stream/reader is the important part of the parsing, lexing and recognition in antlr as getting character stream is important to do all these things. But, we have a parser that works in JEE environment. And unlike DSL we have very small requirement where we have to

[il-antlr-interest: 27244] [antlr-interest] Is it possible to pass input without using a ANTLR stream?

2009-12-13 Thread Asha Ramegowda
Hi, I am aware that antlr input stream/reader is the important part of the parsing, lexing and recognition in antlr as getting character stream is important to do all these things. But, we have a parser that works in JEE environment. And unlike DSL we have very small requirement where we have to

[il-antlr-interest: 27243] Re: [antlr-interest] Problems with memory consumption when generating parsers

2009-12-13 Thread Marcin Rzeźnicki
2009/12/13 Gavin Lambert : > At 07:37 14/12/2009, Marcin Rzeźnicki wrote: >>Specifically I constructed a sort of catch-all rule which I >>called LINEOFTEXT and was like ~('\n' | '\r')*. After >>replacing that with simple .* LINETERMINATOR my problems went >>away. > > Actually, the former is better

[il-antlr-interest: 27242] Re: [antlr-interest] MismatchedTokenException

2009-12-13 Thread Marcin Rzeźnicki
2009/12/13 Jim Idle : > This usually means that your lexer token numbers are out of sync with your > parser tokens. Regen in correct order and make sure all tokens have been > declared. > Umm, what if I work with combined grammar? And some of literals are 'inlined'? > Jim > > On Dec 13, 2009, at

[il-antlr-interest: 27241] [antlr-interest] ANTLRWorks: Why do these rules behave differently in the embedded interpreter?

2009-12-13 Thread kferrio
Hi, This question is so rudimentary that I am almost embarrassed to ask.  But since I almost never try to use ANTLRWorks for my parsers, I'll risk injuring my pride in exchange for learning something. If I paste the Expr.g *verbatim* from http://www.antlr.org/works/help/tutorial/content/Expr.

[il-antlr-interest: 27240] [antlr-interest] possibly outdated advice about java implementations in ANTLRWorks FAQ

2009-12-13 Thread kferrio
FYI.  If anyone is maintaining the info at http://www.antlr.org/works/help/tutorial/howtorun.html, the last sentence on the page may be out of date. I've been using OpenJDL/IcedTea 1.6.x with no problems that I'm aware of. signature.asc Description: OpenPGP digital signature List: http://

[il-antlr-interest: 27239] Re: [antlr-interest] cgram project : updated to antlr 3.2?

2009-12-13 Thread Rahul Garg
Thanks. I am investigating several options now including modifying the v3 ANSI C grammar. I ran into an issue with typedef with that grammar and am trying to reproduce it in a simpler example. rahul On Sun, Dec 13, 2009 at 1:02 PM, Jim Idle wrote: > You could write your own based upon the v3

[il-antlr-interest: 27238] Re: [antlr-interest] Problems with memory consumption when generating parsers

2009-12-13 Thread Gavin Lambert
At 07:37 14/12/2009, Marcin Rzeźnicki wrote: >Specifically I constructed a sort of catch-all rule which I >called LINEOFTEXT and was like ~('\n' | '\r')*. After >replacing that with simple .* LINETERMINATOR my problems went >away. Actually, the former is better than the latter (more specific

[il-antlr-interest: 27237] Re: [antlr-interest] NoViableAltException

2009-12-13 Thread Jim Idle
You need to left factor the common introduction to both lays and decide what it us when you hit ';' or don't. Jim On Dec 13, 2009, at 11:49, Johannes Bittner wrote: > Hello, > > The Java code generated for the following grammar produces a > NoViableAltException when using "void foo (int a,

[il-antlr-interest: 27236] Re: [antlr-interest] MismatchedTokenException

2009-12-13 Thread Jim Idle
This usually means that your lexer token numbers are out of sync with your parser tokens. Regen in correct order and make sure all tokens have been declared. Jim On Dec 13, 2009, at 11:23, Marcin Rzeźnicki wrote: > Hi all, > What could possibly MismatchedTokenException(0!=0) mean? It happ

[il-antlr-interest: 27235] Re: [antlr-interest] NoViableAltException

2009-12-13 Thread Kevin J. Cummings
On 12/13/2009 02:49 PM, Johannes Bittner wrote: > Hello, > > The Java code generated for the following grammar produces a > NoViableAltException when using "void foo (int a, int b) { foo }" as > input, i.e. when the second token is "foo", it works otherwise. I > tried this with antlrworks 1.3.1. C

[il-antlr-interest: 27234] [antlr-interest] NoViableAltException

2009-12-13 Thread Johannes Bittner
Hello, The Java code generated for the following grammar produces a NoViableAltException when using "void foo (int a, int b) { foo }" as input, i.e. when the second token is "foo", it works otherwise. I tried this with antlrworks 1.3.1. Could somebody clearify why this happens? Thanks, Johannes

[il-antlr-interest: 27233] [antlr-interest] MismatchedTokenException

2009-12-13 Thread Marcin Rzeźnicki
Hi all, What could possibly MismatchedTokenException(0!=0) mean? It happened to me when matching lexer token in parser. Input is as expected (the text at the point of error matches what would go into this specific token). It looks like ANTLR lost track of token type identifiers. -- Greetings Marc

[il-antlr-interest: 27232] Re: [antlr-interest] Problems with memory consumption when generating parsers

2009-12-13 Thread Marcin Rzeźnicki
Thank you very much Jim for offering your help but I think I know now what has been hitting me. You are right, that was lexer. Specifically I constructed a sort of catch-all rule which I called LINEOFTEXT and was like ~('\n' | '\r')*. After replacing that with simple .* LINETERMINATOR my problems w

[il-antlr-interest: 27231] Re: [antlr-interest] Fwd: Reporting a bug in C Target

2009-12-13 Thread Jim Idle
Wrestled Hudson into submission but I have not put all the build parameters in place for it until this afternoon, after which the snapshots and so on will all be working again. Unfortunately we have a chicken and egg situation with a change to the generator and the runtime at the same time, whic

[il-antlr-interest: 27230] Re: [antlr-interest] a grammar problem

2009-12-13 Thread Jim Idle
It might be better to lex just one token here and not worry about what characters are in it. Then check it semantically. You will then get errors like "#z is not a vlaid exactness sequence", instead of the lexer saying "Unexpected character 'z'". I see the original question was answered so I won

[il-antlr-interest: 27229] Re: [antlr-interest] Problems with memory consumption when generating parsers

2009-12-13 Thread Jim Idle
The analysis can take a lot of memory and you may just need more stack space, but it could also be your grammar construction. Lexers especially can use a lot of memory to analyse, especially if you specify huge sets of 'valid' characters'. I'll look at it if you send it to me. jim > -Origi

[il-antlr-interest: 27228] Re: [antlr-interest] a grammar problem

2009-12-13 Thread John B. Brodie
On Sun, 2009-12-13 at 17:38 +0100, Hans-Martin Adorf wrote: > An no, blanks are not permitted between #b and #e, since these > character sequences are prefixes for binary numbers in Scheme (#b > signifies a binary number, #e an exact number). > > How can I switch off spaces? the action `{ $channe

[il-antlr-interest: 27227] Re: [antlr-interest] Lexer and Java keywords

2009-12-13 Thread Jim Idle
ANTLR can only know so much from your grammar and in a lexer, when it sees a character it doesn't understand it can only show an error, consume it and move on. The error will not mean much to the user. The idea is leave errors to be reported as high up the tool chain as you can (in general) as y

[il-antlr-interest: 27226] Re: [antlr-interest] cgram project : updated to antlr 3.2?

2009-12-13 Thread Jim Idle
You could write your own based upon the v3 version of the C grammar. Someone was transforming this to a full gcc compatible parser and said they would publish it, but that seems to have gone away. Not sure about ANTLR based tools, but there are plenty of C transformation tools out there. Jim

[il-antlr-interest: 27225] Re: [antlr-interest] Struggling with recursion error

2009-12-13 Thread Jim Idle
> -Original Message- > From: antlr-interest-boun...@antlr.org [mailto:antlr-interest- > > Well, now I just have to tell a little story of how semicolons can > cause a lot of pain, it happened to me recently. It begins with the > horror that is T-SQL, which is one of my day-job languages

[il-antlr-interest: 27224] Re: [antlr-interest] Fwd: Reporting a bug in C Target

2009-12-13 Thread Gokulakannan Somasundaram
Thanks a lot Jim. That was very quick. I will check it out and let you know. Gokul. On Fri, Dec 11, 2009 at 9:43 PM, Jim Idle wrote: > The latest templates process the default parameter values correctly, I > fixed that too – I need to fix Hudson so the snapshot gets built, but you > can also

[il-antlr-interest: 27223] Re: [antlr-interest] a grammar problem

2009-12-13 Thread Hans-Martin Adorf
Hi, thanks, the trick with leaving out one of the question marks does the job. An no, blanks are not permitted between #b and #e, since these character sequences are prefixes for binary numbers in Scheme (#b signifies a binary number, #e an exact number). How can I switch off spaces? Regards Ha

[il-antlr-interest: 27222] [antlr-interest] Problems with memory consumption when generating parsers

2009-12-13 Thread Marcin Rzeźnicki
Hi to all, I am experiencing some problems with excessive memory usage when generating my parser. I allocated 128MB of heap memory to ANTLRWorks and it cannot complete generation of parser for Java-like expressions. I suspect this is rater bad sign but I am not sure whether I need, at this point, t

[il-antlr-interest: 27221] Re: [antlr-interest] Lexer and Java keywords

2009-12-13 Thread Marcin Rzeźnicki
2009/12/10 Sam Harwell : > You're making this too complicated. Parse the identifier as loosely as > absolutely possible. Many improper identifiers actually don't cause any > problems in parsing, so you can treat them as valid and provide compiler > error messages like semantics problems in post-

[il-antlr-interest: 27220] Re: [antlr-interest] a grammar problem

2009-12-13 Thread John B. Brodie
Greetings! On Sun, 2009-12-13 at 14:20 +0100, Hans-Martin Adorf wrote: > here is an excerpt on a SchemeNumber grammar which is part of a Scheme > grammar that I am toying with. > > grammar SchemeNumber; > tokens { > HASH = '#' ; > } > prefix2: RADIX2 EXACTNESS? > | EXACTNESS? R

[il-antlr-interest: 27219] [antlr-interest] a grammar problem

2009-12-13 Thread Hans-Martin Adorf
Hi Folks, here is an excerpt on a SchemeNumber grammar which is part of a Scheme grammar that I am toying with. grammar SchemeNumber; tokens { HASH = '#' ; } prefix2: RADIX2 EXACTNESS? | EXACTNESS? RADIX2 ; RADIX2: HASH ('b'|'B'); EXACTNESS: HASH ('i'|'I'|'

[il-antlr-interest: 27217] [antlr-interest] conditional print

2009-12-13 Thread Thierry USO
Hello, extract of my grammar: procedural_statement : WS? builtin_procedure_name WS? '(' argument (',' argument)*)? ')' WS? ; builtin_procedure_name : CALL_CMD | EXECUTE_CMD | DB_OPEN | DB_CLOSE | DEFINE_LOGICAL CALL_CMD : 'CALL_CMD' ; etc... I want to get (print) the procedural_statement only

[il-antlr-interest: 27216] Re: [antlr-interest] newbie problem about expressions & number representations

2009-12-13 Thread Gavin Lambert
At 13:37 12/12/2009, David-Sarah Hopwood wrote: >I thought lexer rules were supposed to find the longest match? >How can they do that if they're unable to handle common left >prefixes? > >(I have the impression that "longest match" may not be quite >accurate, but if so, I've never seen the ac