[il-antlr-interest: 22076] [antlr-interest] Strange behaviour

2009-02-24 Thread Sam Barnett-Cormack
build. If I uncomment them all, it gives me one of the above warnings for each letter of the alphabet that a keyword starts with, pretty much. Anyone have any idea what's going on? Sam Barnett-Cormack --~--~-~--~~~---~--~~ You received this message because you a

[il-antlr-interest: 22093] Re: [antlr-interest] Strange behaviour

2009-02-25 Thread Sam Barnett-Cormack
ve started adding parser rules, and all is well. Sam Sam Barnett-Cormack wrote: > Hi all, > > I'm back to using ANTLR after a long time away, and in principle I have > to say I'm liking ANTLR3. However, I'm seeing something very strange. > > Based on advice in v

[il-antlr-interest: /] Re: [antlr-interest] antlr beginner confused over ambiguities

2009-02-25 Thread Sam Barnett-Cormack
Rick Schumeyer wrote: > This works, but it gives me one token containing "12:34:56". I still > need to parse the hh,mm,ss values. What is the best way to do that? > > It seems that I want the parser to be able to tell the lexer "normally > you can consider INT:INT:INT as a STRING. But right

[il-antlr-interest: 22110] [antlr-interest] Manipulating text in the lexer

2009-02-26 Thread Sam Barnett-Cormack
e parser, as there's no need whatsoever to hold onto that. However, it's a *requirement* to discard newlines, along with any other whitespace immediately preceding or succeeding each. It'd be really frustrating to have to change that at a later stage in processing. So, can anyo

[il-antlr-interest: 22114] [antlr-interest] Manipulating text in the lexer

2009-02-26 Thread Sam Barnett-Cormack
; that's found inside a string literal into a single '"' before passing it on to the parser, as there's no need whatsoever to hold onto that. However, it's a *requirement* to discard newlines, along with any other whitespace immediately preceding or succeeding each.

[il-antlr-interest: 22125] Re: [antlr-interest] Manipulating text in the lexer

2009-02-26 Thread Sam Barnett-Cormack
Gavin Lambert wrote: > At 04:48 27/02/2009, Sam Barnett-Cormack wrote: > >http://www.antlr.org/blog/antlr3/lexical.tml suggests that it's > >no longer possible to alter the content of a token away from > >what's on the input at all. > > That isn&

[il-antlr-interest: 22156] [antlr-interest] Difficult (to me) recursion problem

2009-02-28 Thread Sam Barnett-Cormack
Hey all, So, my ASN.1 grammar is progressing, but I've run into a problem that I *think* is due to left-recursion complexities. I've attached the whole grammar (bits that are commented out are generally references to rules from other bits of the standards that I haven't reached yet - want to s

[il-antlr-interest: 22159] [antlr-interest] Confusing, hopefully-final, problems

2009-02-28 Thread Sam Barnett-Cormack
Hi all So, I solved the recursion issue (which had been complicated by me failing to notice a '|' in the standard), and fixed a lot of intractable issues using predicates (or backtracking, at least for now). However, I'm still getting some errors/warnings which I can't for the life of me figu

[il-antlr-interest: 22160] Re: [antlr-interest] Difficult (to me) recursion problem

2009-02-28 Thread Sam Barnett-Cormack
Johannes Luber wrote: > Sam Barnett-Cormack schrieb: >> >> If anyone can offer me some guidance, I'd really appreciate it. > > Did you see > <http://www.antlr.org/wiki/display/ANTLR3/Left-Recursion+Removal> already? Looked at it, didn't find anyt

[il-antlr-interest: 22165] Re: [antlr-interest] Confusing, hopefully-final, problems

2009-02-28 Thread Sam Barnett-Cormack
Sam Barnett-Cormack wrote: > Hi all > > So, I solved the recursion issue (which had been complicated by me > failing to notice a '|' in the standard), and fixed a lot of intractable > issues using predicates (or backtracking, at least for now). However, > I

[il-antlr-interest: 22176] [antlr-interest] Confusing, hopefully-final, problems

2009-03-01 Thread Sam Barnett-Cormack
Hi all [resent with grammar *actually* attached] So, I solved the recursion issue (which had been complicated by me failing to notice a '|' in the standard), and fixed a lot of intractable issues using predicates (or backtracking, at least for now). However, I'm still getting some errors/warning

[il-antlr-interest: 22187] Re: [antlr-interest] Confusing, hopefully-final, problems

2009-03-01 Thread Sam Barnett-Cormack
Gavin Lambert wrote: > At 03:10 2/03/2009, Sam Barnett-Cormack wrote: > >[resent with grammar *actually* attached] > > Apparently not. I'm clearly being a moron this weekend. Third time lucky? Sam, feeling like a moron. --~--~-~--~~~---~--~---

[il-antlr-interest: 22192] Re: [antlr-interest] Confusing, hopefully-final, problems

2009-03-02 Thread Sam Barnett-Cormack
Gavin Lambert wrote: > At 11:21 2/03/2009, Sam Barnett-Cormack wrote: > >NUMBER : ; > > Defining non-fragment rules that can succesfully match nothing (ie. > empty string) is Bad(tm). > > >BSTRING : '\'' BSTRINGCONT '\'B'; > [...] &

[il-antlr-interest: 22193] Re: [antlr-interest] Confusing, hopefully-final, problems

2009-03-02 Thread Sam Barnett-Cormack
Hey all, With Gavin's generous help, I'm down to one error and a couple of warnings, which is nice. In the attached grammar, I haven't fixed the lexer issues Gavin identified yet, as I'm focused on the parser for the moment. The error is on line 473, as are two of the warnings. I can't say as

[il-antlr-interest: 22194] Re: [antlr-interest] Confusing, hopefully-final, problems

2009-03-02 Thread Sam Barnett-Cormack
Sam Barnett-Cormack wrote: > Hey all, > > With Gavin's generous help, I'm down to one error and a couple of > warnings, which is nice. > > In the attached grammar, I haven't fixed the lexer issues Gavin > identified yet, as I'm focused on the parser

[il-antlr-interest: 22195] Re: [antlr-interest] Confusing, hopefully-final, problems

2009-03-02 Thread Sam Barnett-Cormack
Sam Barnett-Cormack wrote: > Sam Barnett-Cormack wrote: >> Hey all, >> >> With Gavin's generous help, I'm down to one error and a couple of >> warnings, which is nice. >> >> In the attached grammar, I haven't fixed the lexer issues Gavin &

[il-antlr-interest: 22205] Re: [antlr-interest] Confusing, hopefully-final, problems

2009-03-02 Thread Sam Barnett-Cormack
Jim Idle wrote: > Sam Barnett-Cormack wrote: >> Sam Barnett-Cormack wrote: >> >>> Sam Barnett-Cormack wrote: >>> >>> >>> type : ((typeWithConstraint)=>typeWithConstraint | builtinType | >>> referencedType) constraint* ;

[il-antlr-interest: 22217] [antlr-interest] Error I can't get my head around at all...

2009-03-03 Thread Sam Barnett-Cormack
Hi all, I've wracked my brains on this one, and really can't see what's going on. I've got one error in my grammar, and I just can't see how it's come about. I've been listening to everything people have said, I've been trying to apply what I've learned, most notably drilling into rules and ex

[il-antlr-interest: 22223] Re: [antlr-interest] Error I can't get my head around at all...

2009-03-03 Thread Sam Barnett-Cormack
Jim Idle wrote: > Sam Barnett-Cormack wrote: > I was trying to look at your grammar for you but the one you have > attached is missing some token defs: > > ... > [08:08:06] warning(105): ASN_1.g:456:7: no lexer rule corresponding to > token: BSTRING > [08:08:06] warn

[il-antlr-interest: 22259] Re: [antlr-interest] lookahead DFA too big?

2009-03-05 Thread Sam Barnett-Cormack
Thomas Brandon wrote: > On Thu, Mar 5, 2009 at 9:50 PM, Andreas Meyer > wrote: >> Maybe it's possible to partition the set of keywords, but that would be >> some effort: figuring out for 800 keywords, where they appear, what is >> the context they are used in etc. Note that the problem only appea

[il-antlr-interest: 22260] Re: [antlr-interest] ANTLR IDE 1.3.0 released

2009-03-05 Thread Sam Barnett-Cormack
Edgar Espina wrote: > Hi, > > ANTLR IDE 1.3.0 is now available at http://antlrv3ide.sourceforge.net/. Hi - trying to update my ANTLR IDE installation, I get an error. Part of it seems to have been updated (JDT integration), and as far as I can tell all other components are up to date. Version

[il-antlr-interest: 22273] [antlr-interest] Bug? Invalid Java code generated

2009-03-06 Thread Sam Barnett-Cormack
Hi all The attached grammar (which you're probably all tired of) generates Java code with an error in. I've checked, and the error isn't in a copy action or predicate - it's in the expansion of $text in a parser predicate. I don't know if I've used $text incorrectly, because I'm using it as I

[il-antlr-interest: 22281] Re: [antlr-interest] Bug? Invalid Java code generated

2009-03-06 Thread Sam Barnett-Cormack
Jim Idle wrote: > Sam Barnett-Cormack wrote: >> Hi all >> >> The attached grammar (which you're probably all tired of) generates >> Java code with an error in. I've checked, and the error isn't in a >> copy action or predicate - it's in the

[il-antlr-interest: 22283] Re: [antlr-interest] Bug? Invalid Java code generated

2009-03-06 Thread Sam Barnett-Cormack
Jim Idle wrote: > Sam Barnett-Cormack wrote: >> Jim Idle wrote: >>> Sam Barnett-Cormack wrote: >>>> Hi all >>>> >>>> The attached grammar (which you're probably all tired of) generates >>>> Java code with an error in. I

[il-antlr-interest: 22285] Re: [antlr-interest] Bug? Invalid Java code generated

2009-03-06 Thread Sam Barnett-Cormack
Sam Barnett-Cormack wrote: > Jim Idle wrote: >> Sam Barnett-Cormack wrote: >>> Jim Idle wrote: >>>> Sam Barnett-Cormack wrote: >>>>> Hi all >>>>> >>>>> The attached grammar (which you're probably all tired of) gen

[il-antlr-interest: 22286] Re: [antlr-interest] Bug? Invalid Java code generated

2009-03-06 Thread Sam Barnett-Cormack
Andreas Meyer wrote: > Sam Barnett-Cormack schrieb: >> Hi all >> >> The attached grammar (which you're probably all tired of) generates >> Java code with an error in. I've checked, and the error isn't in a >> copy action or predicate - it's i

[il-antlr-interest: 22302] Re: [antlr-interest] Bug? Invalid Java code generated

2009-03-06 Thread Sam Barnett-Cormack
String or something? Bearing in mind that I can't test at the moment because the computer that that work is one decided to be difficult... Sam > On Mar 6, 2009, at 11:55 AM, Johannes Luber wrote: > >> Sam Barnett-Cormack schrieb: >>> Andreas Meyer wrote: >>>> Sam

[il-antlr-interest: 22305] Re: [antlr-interest] Bug? Invalid Java code generated

2009-03-06 Thread Sam Barnett-Cormack
Terence Parr wrote: > > On Mar 6, 2009, at 2:02 PM, Sam Barnett-Cormack wrote: > >> Terence Parr wrote: >>> Hi Guys,quikly scanning...$text means text for entire rule; if >>> hoisted out of rule it makes no sense. sem predicates should only use >>> fu

[il-antlr-interest: 22335] Re: [antlr-interest] skipping whitespaces in code and avoiding it in comments

2009-03-08 Thread Sam Barnett-Cormack
he WS on the hidden channel. Tokens are usually complete lexical elements - not single characters. Otherwise, the parser may as well be working on the input stream rather than a token stream. -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http:/

[il-antlr-interest: 22347] Re: [antlr-interest] skipping whitespaces in code and avoiding it in comments

2009-03-09 Thread Sam Barnett-Cormack
Maciej Gawinecki wrote: > Hello, > > Thanks for your response. > > Sam Barnett-Cormack wrote: > > [cut] > >> It's far more common to make VALUE, ID, and COMMENT token types (and >> comment different to what you have now - from // to newline inclus

[il-antlr-interest: 22402] Re: [antlr-interest] Simple g rammar will not compile. I can't figure it out.

2009-03-11 Thread Sam Barnett-Cormack
Stevenson, Todd (GE Healthcare, consultant) wrote: > This grammar will not compile. I can't figure out why not. It > generates the error: > > reference to undefined rule: keypath > > even though it exists. Help! > > Thanks. > > --

[il-antlr-interest: 22433] Re: [antlr-interest] ANTLR IDE 1.3.0 released

2009-03-13 Thread Sam Barnett-Cormack
Hey all, Following Edgar's advice, I got this updated and all seems well. However, it appears that while it "supports" ANTLR 3.1.2, it still uses the ANTLR 3.1.1 code generation tool? Is this right? Sam Edgar Espina wrote: > Hi, > > ANTLR IDE 1.3.0 is now available at http://antlrv3ide.source

[il-antlr-interest: 22434] [antlr-interest] Doc-comments in generated Java

2009-03-13 Thread Sam Barnett-Cormack
Hi all, I seem to recall posting about this back in the ANTLR 2 days, but now I found myself running into it again. I'd like there to be some vague documentation generated by Javadoc for my parser/lexer/etc. I've got a combined grammar, with a doc-comment on the grammar itself. This gets attache

[il-antlr-interest: 22442] Re: [antlr-interest] Doc-comments in generated Java

2009-03-13 Thread Sam Barnett-Cormack
Jim Idle wrote: > Sam Barnett-Cormack wrote: >> Hi all, >> >> I seem to recall posting about this back in the ANTLR 2 days, but now I >> found myself running into it again. >> >> I'd like there to be some vague documentation generated by Javadoc for

[il-antlr-interest: 22444] Re: [antlr-interest] Doc-comments in generated Java

2009-03-13 Thread Sam Barnett-Cormack
Gerald Rosenberg wrote: > > There is a related problem concerning annotations. Like class comments, > they need to be positioned below all imports. Perhaps Antlr should not > insert any import statements of its own if the grammar contains a header > block. Don't know how difficult it would be

[il-antlr-interest: 22473] [antlr-interest] AST Visualisation

2009-03-16 Thread Sam Barnett-Cormack
Hi all, Having used google to search the archives, and the whole web, and found only references to some apparently out-of-date stuff to do with "ASTFrame", I'm now asking - does anyone know an easy way to visualise a generated AST? Sam List: http://www.antlr.org/mailman/listinfo/antlr-interest

[il-antlr-interest: 22477] Re: [antlr-interest] AST Visualisation

2009-03-16 Thread Sam Barnett-Cormack
Jim Idle wrote: > Sam Barnett-Cormack wrote: >> Hi all, >> >> Having used google to search the archives, and the whole web, and found >> only references to some apparently out-of-date stuff to do with >> "ASTFrame", I'm now asking - does anyone

[il-antlr-interest: 22480] [antlr-interest] My kooky ASN.1 grammar again - can't find the ambiguity

2009-03-16 Thread Sam Barnett-Cormack
Hi all, I've been trying to actually remove ambiguities, rather than papering over the cracks with backtrack (as I realised there are some fundamental ways in which this isn't going to work). I realised that there are a lot of cases of value expressions being redundant between types. The standard

[il-antlr-interest: 22542] Re: [antlr-interest] Antlr to BNF

2009-03-18 Thread Sam Barnett-Cormack
Stevenson, Todd (GE Healthcare, consultant) wrote: > I am looking for a utility to convert an Antlr grammar to a nice BNF > document that I can use in my documentation. Does one exist? I poked > around on the antlr site and the internet and couldn't see anything. I > don't want to have to build

[il-antlr-interest: 22567] Re: [antlr-interest] CommonTree between target languages

2009-03-20 Thread Sam Barnett-Cormack
might be able to use libraries to help with the Java handling, but direct object--object translation seems unlikely. -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---

[il-antlr-interest: 22585] Re: [antlr-interest] Semantic Predicates in a Lexer

2009-03-20 Thread Sam Barnett-Cormack
ass could do it - override the emit stuff and add functions to access already-generated tokens. -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~-~--~~---

[il-antlr-interest: 22603] [antlr-interest] Invalid code being generated - return attribute not being parsed in @init?

2009-03-21 Thread Sam Barnett-Cormack
Hi all, Working based on the example on page 86 of TDAR, I have the following rule: objIdComponents returns [boolean hasNandN] @init { $hasNandN = false; } : (c=objIdComponent {if $c.nAndN $hasNandN=true;})+ ; And the generated code includes: ASN_1Parser.objIdComponents_return retval = new

[il-antlr-interest: 22605] [antlr-interest] Tree rewriting (filter=true, output=ast)

2009-03-21 Thread Sam Barnett-Cormack
So, I'm trying to deal with some of the parse ambiguities in my grammar lazily - accept lots of stuff in the parser, and do some tree rewriting to fix things (and find some errors). What I want to do is look at all VLIST trees, determine which of the following cases they fit: 1) All children are

[il-antlr-interest: 22608] Re: [antlr-interest] proposal: make .* and .+ always nongreedy

2009-03-21 Thread Sam Barnett-Cormack
Terence Parr wrote: > http://www.antlr.org/jira/browse/ANTLR-392 > > any objections? Would this effectively make rule : .* (some-exit-set) into rule : ~(some-exit-set)* (some-exit-set) Except, presumably, for magic with predicates and LL(*) cunningness? -- Sam Barnett-Cormack L

[il-antlr-interest: 22610] Re: [antlr-interest] proposal: make .* and .+ always nongreedy

2009-03-21 Thread Sam Barnett-Cormack
Terence Parr wrote: > > On Mar 21, 2009, at 12:12 PM, Sam Barnett-Cormack wrote: > >> Terence Parr wrote: >>> http://www.antlr.org/jira/browse/ANTLR-392 >>> any objections? >> >> Would this effectively make >> >> rule : .* (some-exit-set)

[il-antlr-interest: 22620] Re: [antlr-interest] Tree rewriting (filter=true, output=ast)

2009-03-21 Thread Sam Barnett-Cormack
Gavin Lambert wrote: > You should always list your more-specific alternatives above the > less-specific ones (so have your nameAndNumberForm above the ~NAMENUM alt). > > Also, label+=(block ...) doesn't actually work -- the label always ends > up being null. That's annoying, but easy to bare in

[il-antlr-interest: 22621] Re: [antlr-interest] Tree rewriting (filter=true, output=ast)

2009-03-21 Thread Sam Barnett-Cormack
Gavin Lambert wrote: > valueListValue > scope { bool hasOther; bool hasNameNum; } > @init { $valueListValue::hasOther = false; $valueListValue::hasNameNum = > false; } > : ^(VLIST > ( v+=nameAndNumberForm { $valueListValue::hasNameNum = true; } > | (v+=externalValueReference | v+=LCID |

[il-antlr-interest: 22622] Re: [antlr-interest] Tree rewriting (filter=true, output=ast)

2009-03-21 Thread Sam Barnett-Cormack
As this compiles fine from the command-line tool, I'm going to assume this is an ANTLR IDE problem... Edgar, any illumination on this? Sam Sam Barnett-Cormack wrote: > On a separate note, trying to compile the tree grammar with these > adjustments doesn't give me any antlr err

[il-antlr-interest: 22628] [antlr-interest] Weird StringTemplate error on building grammar

2009-03-22 Thread Sam Barnett-Cormack
Hi all, Trying to build my grammar, I get the following (including my command line): s...@canth:~$ java -cp javalib/antlr-3.1.2/lib/antlr-3.1.2.jar org.antlr.Tool -o tmp/junk workspace/asn.1-parse/grammars/ASN_1.g error(10): internal error: workspace/asn.1-parse/grammars/ASN_1.g : java.lang.Ille

[il-antlr-interest: 22632] Re: [antlr-interest] Weird StringTemplate error on building grammar

2009-03-22 Thread Sam Barnett-Cormack
Terence Parr wrote: > > On Mar 22, 2009, at 7:49 AM, Sam Barnett-Cormack wrote: > >> Hi all, >> >> Trying to build my grammar, I get the following (including my command >> line): >> >> s...@canth:~$ java -cp javalib/antlr-3.1.2/lib/antlr-3.1.2.jar

[il-antlr-interest: 22639] Re: [antlr-interest] Weird StringTemplate error on building grammar

2009-03-23 Thread Sam Barnett-Cormack
Jim Idle wrote: > Sam Barnett-Cormack wrote: >> Terence Parr wrote: >>> >>> term+=(~(RSQR|LSQR)))* >>> >>> is your problem. known bug :) can't add sets to a list yet. >>> >> >> The full rule is: >> >&

[il-antlr-interest: 22642] [antlr-interest] Tweaking Java target

2009-03-23 Thread Sam Barnett-Cormack
Hey all, Say I wanted to tweak the Java target - say, create a new DoccedJava target that's identical apart from doing some generated doc-comments in the output. I know that it'd break with new versions and so on, but I'm happy to maintain it privately for my own use. I'm not saying add it to the

[il-antlr-interest: 22644] Re: [antlr-interest] Tweaking Java target

2009-03-23 Thread Sam Barnett-Cormack
Sam Barnett-Cormack wrote: > Hey all, > > Say I wanted to tweak the Java target - say, create a new DoccedJava > target that's identical apart from doing some generated doc-comments in > the output. I know that it'd break with new versions and so on, but I'm > h

[il-antlr-interest: 22649] [antlr-interest] Documenting grammars

2009-03-23 Thread Sam Barnett-Cormack
Hi all, So, we use doc-comments (/** */) in our grammars. However, as far as I can tell, there's no way to auto-process these and generate nice docs. Does anyone know of one? *If* the answer is no, I'm interested in using some of my spare time to create one. I've already looked into adapting the

[il-antlr-interest: 22659] Re: [antlr-interest] Documenting grammars

2009-03-23 Thread Sam Barnett-Cormack
Jim Idle wrote: > Sam Barnett-Cormack wrote: >> Hi all, >> >> So, we use doc-comments (/** */) in our grammars. However, as far as I >> can tell, there's no way to auto-process these and generate nice docs. >> Does anyone know of one? >> >> *If*

[il-antlr-interest: 22662] Re: [antlr-interest] Documenting grammars

2009-03-23 Thread Sam Barnett-Cormack
Sam Barnett-Cormack wrote: > Jim Idle wrote: >> Sam Barnett-Cormack wrote: >>> Hi all, >>> >>> So, we use doc-comments (/** */) in our grammars. However, as far as I >>> can tell, there's no way to auto-process these and generate nice docs. >&

[il-antlr-interest: 22665] Re: [antlr-interest] Documenting grammars

2009-03-23 Thread Sam Barnett-Cormack
to people you present the docs to. However, no way around that if you want to reuse the API. It's all rather a toss-up in many ways. Sam > Sam Barnett-Cormack wrote: >> Sam Barnett-Cormack wrote: >>> Jim Idle wrote: >>>> Sam Barnett-Cormack wrote: >>>>

[il-antlr-interest: 22667] Re: [antlr-interest] Documenting grammars

2009-03-23 Thread Sam Barnett-Cormack
up a quick outline-design, and anyone who wants to help can help me nail it down to something specific, and possibly help actually write it ;) areas that'd speed me up most would be writing output engines and bringing extra (more experienced?) minds to the parsing. Design usually produce

[il-antlr-interest: 22668] [antlr-interest] Using extra channels

2009-03-23 Thread Sam Barnett-Cormack
Hi all, We all (generally) use the default and hidden channels. What if I wanted there to be another channel which, usually, doesn't get used, but if I want to tune to it as well I won't get the actual whitespace? Say for tokens that you mostly won't be interested in, but may want to programmatic

[il-antlr-interest: 22672] Re: [antlr-interest] Documenting grammars

2009-03-23 Thread Sam Barnett-Cormack
Dennis Brothers wrote: > On Mar 23, 2009, at 2:23 PM, Sam Barnett-Cormack wrote: > >> Sam Harwell wrote: >>> Why not create our own format that properly describes grammars? >>> >>> We could group them by the Tokens file they reference to cover &g

[il-antlr-interest: 22674] Re: [antlr-interest] Documenting grammars

2009-03-23 Thread Sam Barnett-Cormack
Dennis Brothers wrote: > On Mar 23, 2009, at 4:31 PM, Sam Barnett-Cormack wrote: > >> Dennis Brothers wrote: >>> Since ANTLR uses ANTLR to parse itself, couldn't the ANTLR grammar >>> be modified or extended to recognize and emit doc comments and >>&

[il-antlr-interest: 22675] Re: [antlr-interest] Documenting grammars

2009-03-23 Thread Sam Barnett-Cormack
Dennis Brothers wrote: > On Mar 23, 2009, at 2:23 PM, Sam Barnett-Cormack wrote: > >> Sam Harwell wrote: >>> Why not create our own format that properly describes grammars? >>> >>> We could group them by the Tokens file they reference to cover &g

[il-antlr-interest: 22698] Re: [antlr-interest] Question regarding "Assignment"

2009-03-24 Thread Sam Barnett-Cormack
Lucien Antlr wrote: > Hi folks, > > Still wrestling with the ins and outs of the tool, I came up with > something I expected to work but that didn't. > > I expected lab=(EQ expr) to assign the AST to "lab", but rather it > always returns a null. > > The equivalent working statement would be

[il-antlr-interest: 22700] Re: [antlr-interest] Antlr and Java Generics

2009-03-24 Thread Sam Barnett-Cormack
Anders Hessellund wrote: > Hi, > > I've been googling and reading FAQs for some information about how Antlr > and Java Generics relate but nothing significant has shown up. > > - Does anyone here know of a good tutorial or perhaps just an example > grammar? > > - One of the thing that I would l

[il-antlr-interest: 22703] Re: [antlr-interest] Curious behaviour: unused rule has unknown effects

2009-03-24 Thread Sam Barnett-Cormack
Gabriele Palma wrote: > I'm modifying my working grammar. I created a new rule which does > something previously done by another rule. I renamed the old rule and > it is now unreferenced in the whole grammar, while old reference now > go to the new rule. Everything seems fine, the grammar recogniz

[il-antlr-interest: 22738] Re: [antlr-interest] [3.1.1] ANTLR3_MIN_TOKEN_TYPE define possibly incorrect

2009-03-25 Thread Sam Barnett-Cormack
h these. LT will still show them, I guess. Wouldn't it be better to have the tree parser control the application of the rule by only applying it "under" the node above? Or if this *is* at the top level, your solution might well work, as you've demonstrated that you only get

[il-antlr-interest: 22743] Re: [antlr-interest] grammar checking/compilation fails on Windows but not on Linux

2009-03-25 Thread Sam Barnett-Cormack
'&'": T__82, T__87, T__90 > [java] > [java] As a result, token(s) T__87,T__90 were disabled for that input > [java] warning(209): src/grammars/JavaScript.g:1307:1: Multiple token > rules can match input such as "'w'": T__62, T__69, Identifier

[il-antlr-interest: 22750] Re: [antlr-interest] grammar checking/compilation fails on Windows but not on Linux

2009-03-25 Thread Sam Barnett-Cormack
25 Jim Idle mailto:j...@temporal-wave.com>> > > Sam Barnett-Cormack wrote: >> Filipe David Manana wrote: >> >>> Hello, >>> >>> I am facing here something weird. >>> >>> I have a grammar which compiles fin

[il-antlr-interest: 22782] Re: [antlr-interest] Documenting grammars

2009-03-26 Thread Sam Barnett-Cormack
- working out an API for receiving and outputing language information. If there's interest in this, I can either keep the list updated, or just those who are interested. If I get it off the ground and ANTLR folks don't want it in the ANTLR stable, I'll sort out other hosting and maili

[il-antlr-interest: 22786] Re: [antlr-interest] Documenting grammars

2009-03-26 Thread Sam Barnett-Cormack
becomes possible to produce unified documentation that, with one "group" of webpages documenting you grammars, your templates, and your classes. Doesn't sound too general to be useful to me. Sam > Sam Barnett-Cormack wrote: >> Okay, this weekend I plan to start work on a sui

[il-antlr-interest: 22793] Re: [antlr-interest] Documenting grammars

2009-03-26 Thread Sam Barnett-Cormack
you can figure out a set of reasonable documentation > practices for grammars, please post them to the list for discussion. > We might learn something. I'll be doing my initial design work (over and above the vague structure in my head) this weekend - I'll certainly post it to th

[il-antlr-interest: 22845] Re: [antlr-interest] Strength of ANTLR lexer

2009-03-30 Thread Sam Barnett-Cormack
Daniels, Troy (US SSA) wrote: > The standard solution here to define fairly generic tokens in the lexer, then > have parser rules that distinguish between them. > > mapping : attribute '=' attribute; > key: ALPHA ; > attribute: ALPHA | ALPHANUM; > ALPHA : ('A'..'Z' | 'a'..'z')+; > ALPHANUM : ('A

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

2009-04-01 Thread Sam Barnett-Cormack
y ambiguity warnings on any other Java implementation. I've had similar issues with ANTLR sporadically claiming that my lexer rules are ambiguous (they aren't unless k=1), and I would hope that my development machine isn't considered underpowered (1.6GHz Atom, 1GB RAM, running

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

2009-04-01 Thread Sam Barnett-Cormack
e a feeling it might be easier to break it more literally into an equivalent of the MetaWare's presumed AST evaluation: Even := 0; Odd := Event; By some tree flattening of some sort. I'd think about it more, but I have to go and have my spine x-rayed. -- Sam Barnett-Cormack List:

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

2009-04-01 Thread Sam Barnett-Cormack
to-left; the value of an assignment expression is the value that was assigned. The AST would be like (ASS Odd (ASS EVEN 0)) I'm sure in your case the dialect your translating to doesn't like it, or you wouldn't be worried, but I thought it was worth mentioning as background.

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

2009-04-01 Thread Sam Barnett-Cormack
standard hook interface so that rules that *can* lead to keywords look them up. It's a fairly standard coding pattern, AFAICT, so providing an ANTLRish way to do it would make sense. I think it's more efficient than a rule-per-keyword (or the equivalent, using

[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 : &#x

[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: 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: 23087] Re: [antlr-interest] Disambiguat ing simple grammar – could anyone help?

2009-04-10 Thread Sam Barnett-Cormack
7;-')=>('-' Integer)|) ; This should prevent range from exiting prematurely. However, if you're designing this language, I'd recommend getting rid of the inherent ambiguity by putting in an expression terminator or requiring start-and-end markers for range (pa

[il-antlr-interest: 23090] Re: [antlr-interest] bug in GnuCParser.g - missing declarations and statements

2009-04-10 Thread Sam Barnett-Cormack
; > } > > This is allowed in the C99 standard, section 6.8.2, and > by the GCC manual section 5.26 "Mixed Declarations and Code". And explicitly not allowed by earlier "standard" (eg ISO, K&R) C standards... do we document what standard StdCPardser is meant to t

[il-antlr-interest: 23105] [antlr-interest] Stupid languages, and parsing them

2009-04-11 Thread Sam Barnett-Cormack
Hi all, In my ongoing project, I need to parse a really crazy structure that wants to change the lexing rules dependent on syntactic factors. I hate this. Within the thing I'm talking about, whitespace and comments are handled as they are the rest of the time (thankfully). Alphanumeric tokens

[il-antlr-interest: 23106] Re: [antlr-interest] Stupid languages, and parsing them

2009-04-11 Thread Sam Barnett-Cormack
Sam Barnett-Cormack wrote: > Hi all, > > In my ongoing project, I need to parse a really crazy structure that > wants to change the lexing rules dependent on syntactic factors. I hate > this. > > > 1) Use member variables to track if the most recent non-WS, non-c

[il-antlr-interest: 23109] Re: [antlr-interest] Stupid languages, and parsing them

2009-04-11 Thread Sam Barnett-Cormack
al Message- > From: antlr-interest-boun...@antlr.org > [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Sam > Barnett-Cormack > Sent: Saturday, April 11, 2009 1:45 PM > To: ANTLR Interest Mailing List > Subject: [antlr-interest] Stupid languages, and parsing them > >

[il-antlr-interest: 23110] Re: [antlr-interest] Stupid languages, and parsing them

2009-04-11 Thread Sam Barnett-Cormack
Thomas Brandon wrote: > On Sun, Apr 12, 2009 at 4:45 AM, Sam Barnett-Cormack > wrote: >> Hi all, >> >> In my ongoing project, I need to parse a really crazy structure that >> wants to change the lexing rules dependent on syntactic factors. I hate >> this. >

[il-antlr-interest: 23120] Re: [antlr-interest] Stupid languages, and parsing them

2009-04-12 Thread Sam Barnett-Cormack
Thomas Brandon wrote: > On Sun, Apr 12, 2009 at 6:01 AM, Sam Barnett-Cormack > wrote: >> I'm not sure an island grammar would work, as I need the eventual AST of the >> "WITH SYNTAX" block to be included in the final AST of the master grammar. >> >&g

[il-antlr-interest: 23133] [antlr-interest] Predicate hoisting pain

2009-04-13 Thread Sam Barnett-Cormack
Hi all, So, in my grammar I have need to re-use rules so they ultimately refer to a different rule (so I don't have to duplicate intersection/union/exception rules). I use a parameter and gated predicates, like so: elements[boolean os] : {!$os}?=>subtypeElements | {$os}?=>objectSetEleme

[il-antlr-interest: 23136] Re: [antlr-interest] Predicate hoisting pain

2009-04-13 Thread Sam Barnett-Cormack
true and passing it... Sam > -Original Message- From: antlr-interest-boun...@antlr.org > [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Sam > Barnett-Cormack Sent: Monday, April 13, 2009 6:33 AM To: ANTLR > Interest Mailing List Subject: [antlr-interest] Pr

[il-antlr-interest: 23137] Re: [antlr-interest] Predicate hoisting pain

2009-04-13 Thread Sam Barnett-Cormack
Sam Barnett-Cormack wrote: > I guess the question really is, for me, why does it get hoisted in one > case and not another? I'm assuming it's because of the choice in the > objectSetSpec rule, and I can't see any way to refactor that to lose the > choice. Of course

[il-antlr-interest: 23139] Re: [antlr-interest] Predicate hoisting pain

2009-04-13 Thread Sam Barnett-Cormack
e. I don't think I fully understand nesting of scopes. Sam (BC) > -Original Message- > From: Sam Barnett-Cormack [mailto:s.barnett-corm...@lancaster.ac.uk] > Sent: Monday, April 13, 2009 7:55 AM > To: Sam Harwell > Cc: ANTLR Interest Mailing List > Subject: Re: [antlr-

[il-antlr-interest: 23140] Re: [antlr-interest] Predicate hoisting pain

2009-04-13 Thread Sam Barnett-Cormack
Sam Barnett-Cormack wrote: > Sam Harwell wrote: >> This will fail unexpectedly with certain types of grammars, as >> demonstrated by some grammars I've sent to the list in the past. I'll >> find them later today and send a link. > > I can't see why it&#

[il-antlr-interest: 23151] Re: [antlr-interest] Predicate hoisting pain

2009-04-13 Thread Sam Barnett-Cormack
Jim Idle wrote: > Sam Barnett-Cormack wrote: >> Hi all, >> >> So, in my grammar I have need to re-use rules so they ultimately refer >> to a different rule (so I don't have to duplicate >> intersection/union/exception rules). I use a parameter and gated

[il-antlr-interest: 23153] Re: [antlr-interest] Predicate hoisting pain

2009-04-13 Thread Sam Barnett-Cormack
Sam Barnett-Cormack wrote: > Jim Idle wrote: >> Sam Barnett-Cormack wrote: >>> Hi all, >>> >>> So, in my grammar I have need to re-use rules so they ultimately refer >>> to a different rule (so I don't have to duplicate >>> inter

[il-antlr-interest: 23154] Re: [antlr-interest] Predicate hoisting pain

2009-04-13 Thread Sam Barnett-Cormack
Jim Idle wrote: > However, as you can obviously distinguish the cases at some point higher > up the rule chain, then if you wish to pursue this, then all you need do > is create a scope with your flag in it at a high enough level, init it > to the default case, then set/unset it as the rules de

[il-antlr-interest: 23157] Re: [antlr-interest] Predicate hoisting pain

2009-04-13 Thread Sam Barnett-Cormack
Jim Idle wrote: > Sam Barnett-Cormack wrote: >> Jim Idle wrote: >>> However, as you can obviously distinguish the cases at some point >>> higher up the rule chain, then if you wish to pursue this, then all >>> you need do is create a scope with your flag in

[il-antlr-interest: 23200] Re: [antlr-interest] multi-line chat messages

2009-04-16 Thread Sam Barnett-Cormack
ian eyberg wrote: > On Wed, Apr 15, 2009 at 10:26:58AM -0700, William H. Schultz wrote: > > also I do have the current list of usernames allowed for these > actions before I start trying to figure out what action is what; > unfortunately since everything gets tokenized BEFORE that logic > happ

[il-antlr-interest: 23219] Re: [antlr-interest] Avoiding the generation of final methods

2009-04-16 Thread Sam Barnett-Cormack
Patrick Schönbach wrote: > Hi all, > > usually, AntLR generates final methods for each rule. However, > sometimes, one would like to subclass the parser. Is there a way to > generate non-final methods? Why do you want the parse methods to be non-final? You can subclass the lexer/parser as lon

[il-antlr-interest: 23222] Re: [antlr-interest] Avoiding the generation of final methods

2009-04-16 Thread Sam Barnett-Cormack
Patrick Schönbach wrote: > On 16.04.2009 17:29, Sam Barnett-Cormack wrote: >> Why do you want the parse methods to be non-final? You can subclass >> the lexer/parser as long as the *class* isn't final. You just can't >> override the final methods, and it&#x

[il-antlr-interest: 23306] [antlr-interest] Confused by warnings

2009-04-21 Thread Sam Barnett-Cormack
So, I have this rule: setting : (LCURL)=>settingLCURL | (LCID|externalValueReference)=>referencedValue | typeornull | value | object ; And I'm getting warnings that multiple choices can match input such as LCID or LCURL. It's true that a lot of the options can match either, bu

[il-antlr-interest: 23320] Re: [antlr-interest] Lexing 7-bit ASCII stream

2009-04-22 Thread Sam Barnett-Cormack
e >>> somehow? >> Yep. Depending on the context, you may want to either use a >> lookahead-based entry predicate to avoid entering the rule if the DIGITs >> aren't binary-safe, or a exit predicate that raises an error if it turns >> out that the sequence wasn

  1   2   >