[il-antlr-interest: 28890] Re: [antlr-interest] help please

2010-05-19 Thread Bart Kiers
On Wed, May 19, 2010 at 2:10 AM, Ernesto Castillo hcast...@rocketmail.comwrote: hello everybody my name is Ernesto and i am calling for help on antlr programming, i am a newby in this and i am in my second semester master , after 12 years ago that finish my degree in computer science but

[il-antlr-interest: 28892] [antlr-interest] The Java Method that Generates the Lexer and the Parser

2010-05-19 Thread Sameh W. Zaky
Dear All, I am a Java developer using ANTLR 1.3.1 I am working is some dynamic environment, so my grammar is changing over time due to the continuous change in vocabulary.. So I was thinking of generating my *.g grammar file automatically not to write it by myself.. But now I face the problem

[il-antlr-interest: 28893] Re: [antlr-interest] The Java Method that Generates the Lexer and the Parser

2010-05-19 Thread Sameh W. Zaky
Sorry, I meant ANTLRWorks 1.3.1.. On Wed, May 19, 2010 at 11:37 AM, Sameh W. Zaky sameh...@gmail.com wrote: Dear All, I am a Java developer using ANTLR 1.3.1 I am working is some dynamic environment, so my grammar is changing over time due to the continuous change in vocabulary.. So I was

[il-antlr-interest: 28894] Re: [antlr-interest] Skip subtree in tree grammar

2010-05-19 Thread Jan H. van der Ven
Hello list, Did someone solve this? I have a similar problem with a grammar I took from this list (Eval.g and Simple.g). It concerns the . ifElse scope { bool expResult; } : ^( IFTHEN b = expression { $ifElse::expResult = b; } ( {$ifElse::expResult == true}?=

[il-antlr-interest: 28895] Re: [antlr-interest] SKIP() vs skip() in 'C' runtime

2010-05-19 Thread Jim Idle
Why? :s/skip\(\)/SKIP()/g However it is a macro defined in the generated code, all you need do is: #define skip() SKIP() In an @section that follows the macro definition of SKIP Jim -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-

[il-antlr-interest: 0] Re: [antlr-interest] another question about custom lexer

2010-05-19 Thread Jim Idle
Well, what language are you talking about? What are you trying to achieve? Why do you think you need a custom lexer? http://perl.plover.com/Questions.html Jim -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest- boun...@antlr.org] On Behalf Of

[il-antlr-interest: 28897] [antlr-interest] Input buffer instead of reading the whole file

2010-05-19 Thread Bob
Hi, a back-breaker question, Is it possible under these circumstances to have the input file read in blocks (say, 8kb) instead of reading the whole file into memory? I'll be writing actions for every rule (not using Antlr's AST). Once the actions are processed the input history is not

[il-antlr-interest: 28898] [antlr-interest] Token lin lexer

2010-05-19 Thread Bob
I'm 1 day into Antlr and hope for an answer to this: With an identifier rule (for example this one): SIMPLE_IDENTIFIER : ( 'a'..'z'|'A'..'Z'|'_' ) ( 'a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$')* ; Is it possible, when the lexer recognizes the input stream to be a SIMPLE_IDENTIFIER, to add some

[il-antlr-interest: 28900] [antlr-interest] null pointer to ADAPTOR-setTokenBoundaries

2010-05-19 Thread Alan Condit
Help!!! I am getting a null pointer to setTokenBoundaries in the following line of generated code. ADAPTOR-setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop); The grammar works under Java. In moving it back to 'C', I changed the language option to 'C', added option

[il-antlr-interest: 28901] Re: [antlr-interest] enums in v4 ANTLR Java code generation considered useless

2010-05-19 Thread Terence Parr
On May 18, 2010, at 2:58 PM, Scott Stanchfield wrote: There are several advantages to enums: * there is a discrete set of values that can be used (no accidental 42's passed in when 42 isn't a token type) * the enum value can carry extra information * the enum values can override methods

[il-antlr-interest: 28902] Re: [antlr-interest] enums in v4 ANTLR Java code generation considered useless

2010-05-19 Thread Scott Stanchfield
You can still define the match in the superclass -- just use an interface like Edgar mentioned and I demonstrated in the clarification note I sent. I think the big value here would be that it forces every place that uses the token types to use the enum names (as there are no integer values). I

[il-antlr-interest: 28903] Re: [antlr-interest] enums in v4 ANTLR Java code generation considered useless

2010-05-19 Thread Terence Parr
On May 19, 2010, at 11:39 AM, Scott Stanchfield wrote: You can still define the match in the superclass -- just use an interface like Edgar mentioned and I demonstrated in the clarification note I sent. oh right. I think the big value here would be that it forces every place that uses the

[il-antlr-interest: 28904] [antlr-interest] company looking for 2 ANTLR developers

2010-05-19 Thread Terence Parr
Hi, a recruiter in NYC has 2 positions to fill for a client. full-time and paying anywhere from $100k to $120k. Contact info: Hamilton Daza Intrigue Systems, Inc. 7211 Austin Street #259 Forest Hills, NY 11375 800.809.0318 Main 917.699.3376 Mobile 718.841.7091 Fax hdaza at intriguesys.com Ter

[il-antlr-interest: 28905] Re: [antlr-interest] enums in v4 ANTLR Java code generation considered useless

2010-05-19 Thread Scott Stanchfield
Hmmm... that's evil, ya know that ;) Good to catch that now, though... Probably LITERAL_1, LITERAL_2, etc. To make it easier for debugging/printing/reporting you could add a pattern property (hmmm... the more I think about it the more I like it... if there's a description it could be printed w/

[il-antlr-interest: 28907] Re: [antlr-interest] enums in v4 ANTLR Java code generation considered useless

2010-05-19 Thread Jim Idle
I also have doubts about the performance characteristics and the possibility of starting to rely on the target language to fill in gaps such as token numbering - we could get to the point where code generators cannot be built for more primitive languages because the schema is relying the

[il-antlr-interest: 28908] Re: [antlr-interest] enums in v4 ANTLR Java code generation considered useless

2010-05-19 Thread Scott Stanchfield
Interesting point re common code generation approaches, but as far as performance goes, it's equivalent - all == tests are done using pointers, which are the same size as ints. If switch is used the ordinal values of the enums are used, and the java compiler may be able to better optimize which

[il-antlr-interest: 28909] Re: [antlr-interest] enums in v4 ANTLR Java code generation considered useless

2010-05-19 Thread Kirby Bohling
On Wed, May 19, 2010 at 2:13 PM, Scott Stanchfield sc...@javadude.com wrote: Interesting point re common code generation approaches, but as far as performance goes, it's equivalent - all == tests are done using pointers, which are the same size as ints. If switch is used the ordinal values of

[il-antlr-interest: 28911] Re: [antlr-interest] enums in v4 ANTLR Java code generation considered useless

2010-05-19 Thread Scott Stanchfield
Don't pre-optimize for things like this. Profile, then optimize. This won't even show up as an issue. I think whoever wrote that page was daydreaming about any minor way performance might be increased - note that they don't talk at all on that page about the big performance issues (I/O,

[il-antlr-interest: 28912] Re: [antlr-interest] null pointer to ADAPTOR-setTokenBoundaries

2010-05-19 Thread Alan Condit
Jim, Here is what I have set in options: options { backtrack = true; memoize = true; language= C; output = AST; ASTLabelType= pANTLR3_BASE_TREE; } The null is inside 'ctx' inside

[il-antlr-interest: 28914] [antlr-interest] Referencing attributes

2010-05-19 Thread Junkman
Greetings, I'm a Antlr noob, and have a question regarding accessing attributes. Where, outside of action, can you reference attributes? One place seems to be as parameter to rule invocation like this: decl: type declarator[ $type.text ] ';' ; This is from The Definitive Antlr Reference,

[il-antlr-interest: 28915] Re: [antlr-interest] null pointer to ADAPTOR-setTokenBoundaries

2010-05-19 Thread John B. Brodie
Pardon me for butting in. And I have never used the C code generator, but. On Wed, 2010-05-19 at 14:06 -0700, Alan Condit wrote: which I assume, based on the comment, is generated from this rule: line : line_number? segment+ K_NEWLINE - ^(STMT segment+) |

[il-antlr-interest: 28916] Re: [antlr-interest] Question about building code generation target

2010-05-19 Thread Naveen
On Jan 16 2009, 4:51 pm, Jim Idle j...@temporal-wave.com wrote: When you change your template or codegen target java file, you just type: mvn And it rebuilds just what has changed in a second or two (depends on your machine speed of course). On my slow machine, this takes 33 seconds after

[il-antlr-interest: 28918] Re: [antlr-interest] null pointer to ADAPTOR-setTokenBoundaries

2010-05-19 Thread Alan Condit
On page 164 of The Definitive Antlr Reference under the heading Omitting Input Elements Terrance shows using an empty rewrite rule to allow omitting unneeded symbols from the output AST tree. This does not say that it could not be causing a problem with the generated 'C' code. Jim, is there a

[il-antlr-interest: 28919] Re: [antlr-interest] null pointer to ADAPTOR-setTokenBoundaries

2010-05-19 Thread Jim Idle
I think you will have to put those three productions in separate rules, but I will look into it more. Jim -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest- boun...@antlr.org] On Behalf Of Alan Condit Sent: Wednesday, May 19, 2010 2:06 PM To:

[il-antlr-interest: 28920] Re: [antlr-interest] C target - initialization of return/scope structures

2010-05-19 Thread Jim Idle
Why would you try to use a return value that you have not set? If it is set to NULL then you will core dump unless you check for NULL so it would not help you. The values are not initialized because I don't know what they are, they might be object references or something that cannot be set to

[il-antlr-interest: 28921] Re: [antlr-interest] enums in v4 ANTLR Java code generation considered useless

2010-05-19 Thread Jim Idle
I suspect that your benchmark runs afoul of clock granularity issues for the JIT. If you run it a few times you will likely get different results. Also you say 10% better for enums but look at your results again. Take the client JIT, your first run gives: Enum Time: 25707993 Int Time :

[il-antlr-interest: 28922] Re: [antlr-interest] null pointer to ADAPTOR-setTokenBoundaries

2010-05-19 Thread Jim Idle
Possibly, though I suspect your easy work around is to make each alt a subrule. I will look tomorrow. Jim -Original Message- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest- boun...@antlr.org] On Behalf Of Alan Condit Sent: Wednesday, May 19, 2010 5:01 PM To:

[il-antlr-interest: 28923] Re: [antlr-interest] enums in v4 ANTLR Java code generation considered useless

2010-05-19 Thread Scott Stanchfield
I just ran that code with it looping through doEnums/doInts 1000 times. The difference was ~5% for -client and -Xbatch, and ~10% for -server. (I tried -Xint and it took waay too long). All had enums as higher, which sounds reasonable (as there's static field lookups being done) My main point