[il-antlr-interest: 25676] Re: [antlr-interest] Rule automation

2009-09-09 Thread Sam Barnett-Cormack
Vaclav Barta wrote: > On Wednesday 09 September 2009 11:24:06 Sam Barnett-Cormack wrote: >> Rule templatisation might be a funky feature to be added, but it doesn't >> exist at present, AFAIK. > I suppose most users of such capabilities would want to make their own s

[il-antlr-interest: 25671] Re: [antlr-interest] Rule automation

2009-09-09 Thread Sam Barnett-Cormack
it, like an operator ? > > > Cheers, > Martin > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- Sam Barnett-Cormack List: http://www.

[il-antlr-interest: 25646] Re: [antlr-interest] Matching fragments

2009-09-07 Thread Sam Barnett-Cormack
Gavin Lambert wrote: > At 05:31 8/09/2009, Sam Barnett-Cormack wrote: > >However, the rules I'll pass them to won't match EOF. > > > >It strikes me that all I need to do is make the token stream > >wrapper *not* return an EOF. However, the docs seem to s

[il-antlr-interest: 25640] [antlr-interest] Matching fragments

2009-09-07 Thread Sam Barnett-Cormack
ever, the rules I'll pass them to won't match EOF. It strikes me that all I need to do is make the token stream wrapper *not* return an EOF. However, the docs seem to specify that it *should* return an EOF. How, practically or ideally, should I resolve this? -- Sam Barnett-Cormack L

[il-antlr-interest: 25624] Re: [antlr-interest] lexer's rule overlapping problem

2009-09-06 Thread Sam Barnett-Cormack
e DIGs in another, you have a problem. One solution would be to make INT and ID into parser rules, int and id, formed as DIG+ and ENG+ respectively. That would leave a messy tree, though. -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.

[il-antlr-interest: 25506] Re: [antlr-interest] what's in a name?

2009-08-27 Thread Sam Barnett-Cormack
Graham Wideman wrote: > "Language Processor Patterns" or "Patterns in Language Processing" (3.5 > words :-) "Language Implementation Patterns" would be lovely if it weren't for someone having bagged the term "implementation pattern"...

[il-antlr-interest: 25505] Re: [antlr-interest] what's in a name?

2009-08-27 Thread Sam Barnett-Cormack
Terence Parr wrote: > On Aug 27, 2009, at 2:34 PM, Sam Barnett-Cormack wrote: >> I still think "Language Design Patterns" is misleading, really, as >> it's not really about the languages, it's about recognisers and >> other implementation issues

[il-antlr-interest: 25500] Re: [antlr-interest] what's in a name?

2009-08-27 Thread Sam Barnett-Cormack
ot;Language Design Patterns" is misleading, really, as it's not really about the languages, it's about recognisers and other implementation issues. It's design, in the sense of the design of the recogniser. -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/listinfo/antlr-

[il-antlr-interest: 25495] Re: [antlr-interest] what's in a name?

2009-08-27 Thread Sam Barnett-Cormack
). Of course, now I'm selling a concept for a third book... So I think ANTLR Design Patterns - Techniques and Strategies for Language Implementation. Add "Domain Specific" before "Language" if the publishers are so keen on the buzzwords. Where do you draw the line on a

[il-antlr-interest: 25492] Re: [antlr-interest] what's in a name?

2009-08-27 Thread Sam Barnett-Cormack
guage Implementation", or are we *not* excluding langauge design, just wanting to make sure it's clear that implementation is there as well? -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-inter

[il-antlr-interest: 25467] Re: [antlr-interest] Recognizing 5-th hex digit

2009-08-26 Thread Sam Barnett-Cormack
UTF-16, something from ISO-2022, whatever) to UTF-32, surrogate pairs are likely to *not* work, as they aren't present in the resulting byte stream. Well, that was a random outpouring... -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http:

[il-antlr-interest: 25455] Re: [antlr-interest] ANTLR Javadocs

2009-08-26 Thread Sam Barnett-Cormack
cally require branching off the version control points for each release to add the required config, etc etc. Sam > On Aug 25, 2009, at 6:37 PM, Terence Parr wrote: > >> >> On Aug 25, 2009, at 2:19 PM, Sam Barnett-Cormack wrote: >> >>> David-Sarah Hopwood wrote: &

[il-antlr-interest: 25439] Re: [antlr-interest] ANTLR Javadocs

2009-08-25 Thread Sam Barnett-Cormack
rectoy structures and suchlike used by javadoc, including a specific file I forget the name of, that it uses to figure out which classes are under which URL. -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/ma

[il-antlr-interest: 25438] Re: [antlr-interest] ANTLR Javadocs

2009-08-25 Thread Sam Barnett-Cormack
't huge, it's not usually much bother for a project website to include them, even for every release. This is especially true when compared with the bother for *every* project that'll use it. StringTemplate has online javadocs, the Java Platform does (obviously), so does, for examp

[il-antlr-interest: 25427] Re: [antlr-interest] ANTLR Javadocs

2009-08-25 Thread Sam Barnett-Cormack
So, no intetion to provide this, then, Ter et al? Sam Barnett-Cormack wrote: > Jim Idle wrote: >> Sam Barnett-Cormack wrote: >>> Tom Ball wrote: >>> >>>> Do you mean something other than http://antlr.org/api/Java/index.html >>>&g

[il-antlr-interest: 25426] Re: [antlr-interest] parse tree construction

2009-08-25 Thread Sam Barnett-Cormack
hing :( I *believe* (I may be wrong) that you need to formulate the rule using recursion, rather than EBNF. While (tail-)recursion and EBNF are equivalent in matching, they produce different results in tree constructions. I could very well be wrong, of course. -- Sam Barnett-Cormack List:

[il-antlr-interest: 25362] Re: [antlr-interest] tree parser syntax

2009-08-20 Thread Sam Barnett-Cormack
enVocab, explained in the context of treegrammars at http://www.antlr.org/wiki/display/ANTLR3/4.+Tree+Parsing -- 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: 25344] Re: [antlr-interest] tree parser syntax

2009-08-19 Thread Sam Barnett-Cormack
t the examples (in the > separate examples zipfile). > > > > > -- > -safiye > > > -------- > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubsc

[il-antlr-interest: 25336] Re: [antlr-interest] VCard parser

2009-08-19 Thread Sam Barnett-Cormack
nd parsing. KEY and VALUE are identical, so it'll never work. If you really want LINE as a lexer rule, KEY and VALUE have to be fragment rules. It makes more sense to have a rule, say, SYMBOL, and a rule EQ, as follows: SYMBOL : ('a'..'z'|'A'..'Z')+

[il-antlr-interest: 25305] Re: [antlr-interest] Matching Last Line in ANTLR?

2009-08-18 Thread Sam Barnett-Cormack
ise, there's a non-antlr solution. Pre-cache the file (ie load it to a string buffer), check if the last character is a \n, if it isn't, append one. Then use a relevant reader to pass the buffer to the lexer, rather than the file. -- Sam Barnett-Cormack List: http://www.antlr.org/m

[il-antlr-interest: 25292] Re: [antlr-interest] ANTLR Javadocs

2009-08-17 Thread Sam Barnett-Cormack
Jim Idle wrote: > Sam Barnett-Cormack wrote: >> Tom Ball wrote: >> >>> Do you mean something other than http://antlr.org/api/Java/index.html >>> and http://www.stringtemplate.org/api/index.html? >>> >> >> That ST one is great, but t

[il-antlr-interest: 25290] Re: [antlr-interest] ANTLR Javadocs

2009-08-17 Thread Sam Barnett-Cormack
t put them in. Sam > On Fri, Aug 14, 2009 at 3:56 PM, Sam Barnett-Cormack > <mailto:s.barnett-corm...@lancaster.ac.uk>> wrote: > > I remember a conversation about this before, but now I have a specific > request that doesn't seem to have been fulfilled.

[il-antlr-interest: 25247] Re: [antlr-interest] Lexer rules

2009-08-15 Thread Sam Barnett-Cormack
er[]' and 'interger[][][]' as ENTERO_V tokens. I think there's some rethinking wants to be done between what is in the lexer and what is in the parser. For example, isn't '[]' really an operator, or modifier, and wants to be dealt with in the parser, not bundled

[il-antlr-interest: 25234] [antlr-interest] ANTLR Javadocs

2009-08-14 Thread Sam Barnett-Cormack
ike this purely so that my generated javadocs cleanly link to it, automatically (with some config). Any chance of this happening, or if it has, where is it? -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antl

[il-antlr-interest: 25195] Re: [antlr-interest] Why and how exactly does ANTLR manage to fail on non recursive grammar for finite language?

2009-08-13 Thread Sam Barnett-Cormack
es some improvements. > Loring Craymer wrote: >> Not true; your example can be interpreted either as >> >> (expr1: PREFIX_1 (expr2: PREFIX_2 SUFFIX) SUFFIX ) >> >> or as >> >> (expr1: PREFIX_1 (expr2: PREFIX_2) SUFFIX) SUFFIX >> >> w

[il-antlr-interest: 25180] Re: [antlr-interest] Why and how exactly does ANTLR manage to fail on non recursive grammar for finite language?

2009-08-12 Thread Sam Barnett-Cormack
g a guess, would it be okay if expr was EOF-terminated? -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~-~--~~~---~--~~ You received t

[il-antlr-interest: 25160] Re: [antlr-interest] tokens in parser grammar

2009-08-12 Thread Sam Barnett-Cormack
> C target. Last version of Antlr If it's a combined grammar, that'll work, but it's better in many ways to put it in the lexer as a token. If the lexer and parser are separate, I believe it won't work. -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/lis

[il-antlr-interest: 25105] Re: [antlr-interest] could not even do k=1 for decision xx; reason: timed out

2009-08-08 Thread Sam Barnett-Cormack
t; - but not. $addExpr.tree in the second version is always NIL. Well, $addExpr is the result of the current parser rule, as that expression appears to appear in the addExpr: rule. Of course it's going to produce odd results. -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/listin

[il-antlr-interest: 25100] Re: [antlr-interest] could not even do k=1 for decision xx; reason: timed out

2009-08-08 Thread Sam Barnett-Cormack
, if you put the output rule *inside* the optional subrule, it only applies if the optional subrule matches. Thus the case where the subrule doesn't match produces a single node, and where it does it produces the output you specify. > Goot point about the "a + b + c&quo

[il-antlr-interest: 25090] Re: [antlr-interest] could not even do k=1 for decision xx; reason: timed out

2009-08-07 Thread Sam Barnett-Cormack
single node) takes place. Your grammar doesn't appear to support expressions like 3 + 4 - 5 or 2 * 3 / 5 Sam > --- On *Fri, 8/7/09, Sam Barnett-Cormack > //* wrote: > > > From: Sam Barnett-Cormack > Subject: Re: [antlr-interest] could not even do k=1 for decision

[il-antlr-interest: 25067] Re: [antlr-interest] Whitespace: More than meets the eye?

2009-08-06 Thread Sam Barnett-Cormack
messy in the end... I'd lex $id and id entirely separately, as they are syntactically distinct entities. $blah is always a variable, a "true" variable, and $c->member should be three tokens - a VARIABLEID ($c), a MEMBER (->) and an ID (member). If PHP requires there be no sp

[il-antlr-interest: 25063] Re: [antlr-interest] Whitespace: More than meets the eye?

2009-08-05 Thread Sam Barnett-Cormack
fication you're working from that makes whitespace 'sometimes' significant? You example was a function call or declaration. You can always get help from the lexer here if there are situations where there *must* be a space, and situations where there *mustn't* be a space, and

[il-antlr-interest: 25025] [antlr-interest] Paranoia, paranoia...

2009-08-04 Thread Sam Barnett-Cormack
(potentially being a subtree themselvs). Does this do what I think it does? NB: constraint+ doesn't work because it can't tell how far to look ahead. It has to finish matching one and then see if there's more. -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/listin

[il-antlr-interest: 24980] Re: [antlr-interest] Generated classes - annotations

2009-08-02 Thread Sam Barnett-Cormack
references > > > > right before the method definition. Bob's your uncle, and you have > annotations. > > ANTLR's output template mechanism allows you to name any action you want > and then reference it from the output templates. > > Ter > > On Au

[il-antlr-interest: 24979] Re: [antlr-interest] Generated classes - annotations

2009-08-02 Thread Sam Barnett-Cormack
nd you have > annotations. > > ANTLR's output template mechanism allows you to name any action you want > and then reference it from the output templates. So you can literrally do @foo {blah} and reference ? Sam > On Aug 1, 2009, at 1:32 PM, Sam Barnett-Cormack wrote: &

[il-antlr-interest: 24973] [antlr-interest] Generated classes - annotations

2009-08-01 Thread Sam Barnett-Cormack
ings (dead code, unused local variables, unused imports...). If there were just something, akin to @header, that appeared between the antlr-generated imports and the actual class, that would do the trick - for doc-comments (of the class) and for annotations. Just a thought. -- Sam Barnett-Corm

[il-antlr-interest: 24440] [antlr-interest] Guidance sought on use of Maven and Eclipse

2009-06-30 Thread Sam Barnett-Cormack
Hi all, So, currently I'm using eclipse with ANTLR IDE, and it's working nicely. I'm moving toward mavenising my work (which is broken into multiple projects), and the bits without ANTLR use are going fine. However, for the ANTLR bits, I'd ideally make use of maven's ANTLR plugin to make the

[il-antlr-interest: 24303] Re: [antlr-interest] Experiences going to XML DOM from AST...

2009-06-22 Thread Sam Barnett-Cormack
er in between - but it's a pretty easy layer. Assuming you're using Java, create a data binding of your XML, using (for example) JAXB. Then have the tree grammar build these Java objects, and then use JAXB's internal capability to turn them into DOM. Sometimes an extra step sa

[il-antlr-interest: 24275] Re: [antlr-interest] Grammar in java /c and c ++ to identify all the functions

2009-06-18 Thread Sam Barnett-Cormack
back here once you've encountered a problem, and had a good bash at it. There's lots of docs, lots of example grammars, and a very good book available to help you learn. -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.

[il-antlr-interest: 24219] Re: [antlr-interest] Anltr 3.1.3

2009-06-14 Thread Sam Barnett-Cormack
Jim Idle wrote: > In fact antlr is an executable jar so long as you download the complete > all-in-one jar. > > Java -jar ... And in this case, the double-click wouldn't really work, as you need to give it command-line arguments. Sam > On Jun 14, 2009, at 9:21 AM,

[il-antlr-interest: 24214] Re: [antlr-interest] Anltr 3.1.3

2009-06-14 Thread Sam Barnett-Cormack
support. You have to play > email tag with your teacher for help. Do you have a student rep? Someone ought to be complaining. > -Original Message- > From: Sam Barnett-Cormack [mailto:s.barnett-corm...@lancaster.ac.uk] > Sent: Sunday, June 14, 2009 06:21 > To: Bryan S

[il-antlr-interest: 24211] Re: [antlr-interest] Anltr 3.1.3

2009-06-14 Thread Sam Barnett-Cormack
other bits and bobs. If you download ANTLRworks, it'll just work, *provided* you have an up-to-date JRE (preferably JDK) installed. If this is a course requirement, shouldn't there be support for this from your department? -- Sam Barnett-Cormack List: http://www.antlr.org/mailman/li

[il-antlr-interest: 24210] Re: [antlr-interest] ANTLR Rookie Here

2009-06-14 Thread Sam Barnett-Cormack
e-clicking them. The ANTLR tool isn't an executable jar, but ANTLRWorks will run it for you quite happily. If you need to run it separately, you just have to use a windows command line. If you are using a mac, I believe it's similar to windows in terms of running things. -- Sam Ba

[il-antlr-interest: 24194] Re: [antlr-interest] About literal supports unicode

2009-06-13 Thread Sam Barnett-Cormack
Ha Luong wrote: > Dear all, > > I tried to use the grammar for accepting the unicode string as follow: > //modify T.g in the example source of ANTLR book > grammar T; > options { > language=Java; > } > @members { > String s; > } > r : ID '#' {s = $ID.text; System.out.println("found "+s);} ; >

[il-antlr-interest: 24080] Re: [antlr-interest] "Languag e design patterns" book available in beta

2009-06-06 Thread Sam Barnett-Cormack
tating the most interesting part of the book is >>> crazy! >>> >>> -- >>> uL >>> >>> Pragmatist >>> http://blog.ugolandini.com >>> http://www.flickr.com/photos/ugol/ >>> >>> List: http://www.antlr.org/mai

[il-antlr-interest: 23947] Re: [antlr-interest] More hoisting pain

2009-06-01 Thread Sam Barnett-Cormack
Hi all, Resolved with scoping, but I'm sure this problem is occuring more than one might hope. Is this something the devs are considering and/or working on? Sam Sam Barnett-Cormack wrote: > Hi all, > > Been away from work ill for a while, and now returning to my ASN.1 pro

[il-antlr-interest: 23928] [antlr-interest] More hoisting pain

2009-05-30 Thread Sam Barnett-Cormack
Hi all, Been away from work ill for a while, and now returning to my ASN.1 project. I'm having another hoisting issue. I have the following rule: fixedTypeValueFieldSpec : IOLCID t=typeOrClass ({!($t.obj)}? UNIQUE |) ( {!($t.obj)}? valueOptionalSpec | {$t.obj}? objectOpti

[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

[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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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

  1   2   >