[il-antlr-interest: 26660] Re: [antlr-interest] Strange bug in ANTLR version higher than 3.1.2

2009-11-04 Thread Graham Wideman
And could you describe what *is* the strange bug you are seeing? Ie: what did you see vs what did you expect? -- Graham List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~-~--~~--

[il-antlr-interest: 26609] Re: [antlr-interest] Cannot launch the debugger Time-out waiting toconnect to the remote parser

2009-11-02 Thread Graham Wideman
Indeed, Jim, would you be so kind as to summarize what all has to succeed for the debugger connection to proceed to the point where it provides an initial response in AW? If I'm not mistaken, it has to get to the point of the lexer digesting all the input, is that right?  I think that's perhaps w

[il-antlr-interest: 26534] Re: [antlr-interest] dumbie question: Are there any examples ofbuilding antlr programs using different IDEs?

2009-10-27 Thread Graham Wideman
Raymond, The matter of using Antlr to generate java files for parser or lexer can be separated from the matter of using your IDE. You can run antlr from the command line, using whatever kind of grammar file (lexer, combined, parser, tree) and tell it to send the output (java) files to the dir

[il-antlr-interest: 26502] Re: [antlr-interest] Nested multi-line comments

2009-10-24 Thread Graham Wideman
Peter: I surmise from this that your main test routine is trying to call g.ML_COMMENT, when it should be calling the top level (starting) lexer rule method: g.code(); -- Graham At 10/25/2009 01:03 AM, Peter Boughton wrote: >Thanks John, but this doesn't appear to be working. >(I'm using an

[il-antlr-interest: 26376] Re: [antlr-interest] Combining multiple tokens

2009-10-18 Thread Graham Wideman
I'm not entirely sure I understand the particulars of what you're trying to do but... At 10/18/2009 05:01 PM, Jeffrey Cameron wrote: > > I have two parser rules in my grammar where I am trying to wrap the complete, > concatenated text of a series of tokens into a single token for a tree > grammar

[il-antlr-interest: 26302] Re: [antlr-interest] SEEMS NOBODY HERE LIKE TO HELP OTHERS

2009-10-16 Thread Graham Wideman
David: > I also have received scant (or no help) on this forum I see that you started two threads. In one, Jim Idle gave you a thoughtful response, and suggested some questions to pursue. You did post some more, and nobody answered so far as I can see. That could be because the subject line on

[il-antlr-interest: 26254] Re: [antlr-interest] Learning the basics of ANTLR

2009-10-14 Thread Graham Wideman
Hi Evan -- couple more points on your xml grammar directly relating to your questions. 1. On checking, as I suspected yesterday, the pattern: ('x'|'X') ('m'|'M') ('l'|'L') ... is not scoring a hit because the parser slurps up "xml" as a GENERIC_ID, not as a sequence of three single-character

[il-antlr-interest: 26253] Re: [antlr-interest] Learning the basics of ANTLR

2009-10-14 Thread Graham Wideman
Just a minor fixup for anyone who stumbles on this thread. Yesterday I wrote: >So far as I know, there is no impact of order in which the lexer and parser >rules appear in the .g file. ... I later realized this could be misleading. I meant order of lexer rules relative to parser rules. Ie: lex

[il-antlr-interest: 26245] Re: [antlr-interest] accepting nested code blocks

2009-10-13 Thread Graham Wideman
Miklos: Seems like a bug in AW interpreter. At 10/13/2009 09:16 PM, Espák MiklósbPNz wrote: >This is exactly what I want, but it does not work for me. Incredible! >Do you use 3.2, too? I'm using 3.2 and AW 1.3. For me this grammar fails in AW interpreter, but works if i compile it. --

[il-antlr-interest: 26244] Re: [antlr-interest] Learning the basics of ANTLR

2009-10-13 Thread Graham Wideman
bute >: GENERIC_ID WS? '=' WS? VALUE > >; > >end_tag >: '' > >; > >comment > : '' > ; > >cdata > : '' > ; > > > >GENERIC_ID >: ( LETTER | '_' | &

[il-antlr-interest: 26241] Re: [antlr-interest] Learning the basics of ANTLR

2009-10-13 Thread Graham Wideman
You haven't shown your revised grammar. However, in the old grammar the xmldecl rule says that an attribute is required, so feeding in just: xml will not satisfy xmldecl. -- Graham At 10/13/2009 11:24 AM, Evan Metheny wrote: >Thanks for the response Graham > >> Fragments can only be part of a

[il-antlr-interest: 26240] Re: [antlr-interest] Learning the basics of ANTLR

2009-10-13 Thread Graham Wideman
You've defined GENERIC_ID as a fragment. Fragments can only be part of another lexer rule, they are not stand-alone token-producing lexer rules. Henxe the missing token exception. Also: > I cant >understand why it would break the recognition of "XML" when its before >the attribute call. So fa

[il-antlr-interest: 26220] Re: [antlr-interest] Does lexer EVER use longest match?

2009-10-13 Thread Graham Wideman
(Kirby sent me a lengthy email on observations about ANTLR's lexer behavior, prompting me to nose around some more...) Thanks Kirby for your lengthy comments. Actually, I guess I was aware that mToken would indeed choose the longest *fixed-length* alternative -- what I was really puzzling over

[il-antlr-interest: 26219] [antlr-interest] Does lexer EVER use longest match?

2009-10-12 Thread Graham Wideman
Hi folks: I've been scouring the list archives trying to scrape together a better understanding of what variants of lexer code ANTLR might generate. I keep seeing assertions that ANTLR lexers use longest match to select between otherwise ambiguous alternatives, and other assertions that it doe

[il-antlr-interest: 26217] Re: [antlr-interest] More on Lexer 2-char seq handling

2009-10-12 Thread Graham Wideman
By way of completeness, here I add to my previous message a way to get ANTLR to generate a functioning rule method with the desired lookahead detection for "stop before this 2-char sequence", without hand editing the generated code. Sticking with a variant of Martin Potier's grammar: -

[il-antlr-interest: 26215] [antlr-interest] More on Lexer 2-char seq handling

2009-10-12 Thread Graham Wideman
Hi folks: Further to the discussion on lexer matching sequence that should stop before some multi-character pattern: I read Kirby's post with interest, including the list discussions pointed to. I'm not sure what to make of it. The oddity to me is that ANTLR *almost* generates the right thi

[il-antlr-interest: 26210] [antlr-interest] Gavin: Lexer 2-char seq handling

2009-10-12 Thread Graham Wideman
Hi Gavin (and Joan and Martin): In the last couple of days you've advised on how to handle lexer rules that eat a sequence of chars that should stop when it gets to some 2-char sequence: ']]' in Martin's case '${' in Joan's case In looking into this, I see the same thing in the generated code

[il-antlr-interest: 26189] Re: [antlr-interest] Lexer for a grammar similar to a template engine

2009-10-11 Thread Graham Wideman
First off, your OTHER rule should contain OR not AND if you want to accept '$' or '{' when they are not part of '${'. Other than that, it should be possible to write this without resorting to an action (semantic predicate), which would allow visualizing in ANTLRworks and so on. -- Graham >

[il-antlr-interest: 26169] Re: [antlr-interest] Whitespace question

2009-10-09 Thread Graham Wideman
At 10/9/2009 12:35 PM, Reid Rivenburgh wrote: >Indhu Bharathi wrote: >> Try something like >> >> r : lbl=searchTerm ({spaceFollows($lbl.stop)}?=> lbl=searchTerm)* >> ; >> >> @members { >> public boolean spaceFollows(Token tkn) { >> return input.get(tkn.getTokenInd

[il-antlr-interest: 26157] [antlr-interest] Harwell C#: where to get?

2009-10-08 Thread Graham Wideman
Hi Sam (or others able to answer), I gather from your recent post "C++ grammar for ANTLR v3?" that your code includes a grammar for ANTLR v3 written in v3 grammar language? If so, is it available, and where? At this stage I really am just looking for the .g file(s). Thanks, Graham List: htt

[il-antlr-interest: 26119] Re: [antlr-interest] Why BANG after rule id ?

2009-10-06 Thread Graham Wideman
Hi Kaleb and Kirby, Thanks for taking a look at this. Like you both, I did not find this documented anywhere. The grammar fragment that I showed as an example (rule range) was from the ANTLR v3 grammar, and is itself a v3 grammar, and ANTLR 3 processes it with no complaint. Kaleb quotes the

[il-antlr-interest: 26099] [antlr-interest] Why BANG after rule id ?

2009-10-06 Thread Graham Wideman
Hi folks: I see in the ANTLR grammar that you can place a BANG (exclamation point) after the initial rule id in a rule. Indeed it's used in the ANTLR v3 grammar itself: range! : c1=CHAR_LITERAL RANGE c2=CHAR_LITERAL elementOptions? -> ^(CHAR_RANGE[$c1,".."] $

[il-antlr-interest: 25957] Re: [antlr-interest] sql keyword issue

2009-09-27 Thread Graham Wideman
Hi Min, I'm a little puzzled at your example, but I'll take a crack at it. 1. "we have a statement CREATE USER, where USER is not a keyword," ... except that you have made a separate USER token. So likely the error results from this: where the parser is looking for an Identifier in rule userI

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

2009-08-28 Thread Graham Wideman
At 8/28/2009 09:16 PM, Tom Davies wrote: >On 28/08/2009, at 6:25 AM, Sam Barnett-Cormack wrote: >> you'd hardly be the first to port the idea to >> another domain. > >Someone's even done it with Architecture (he uses the term to refer to >buildings, not computer systems too -- doubly confusing!)

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

2009-08-27 Thread Graham Wideman
Hi Ter, I'm glad you're bringing up the book title issue -- I had wanted to mention it but figured that it was already locked down. Apparently not. First, I concur that the existing title does not do the book justice, it's not about the Design Patterns in Languages themselves. Now what to do.

[il-antlr-interest: 25238] Re: [antlr-interest] Getting weird jar error on antlr-3.1.3.jar

2009-08-14 Thread Graham Wideman
Hi Richard, I jJust tried it like this: D:\Antlr20090807\antlr-3.1.3\lib>jar -tf antlr-3.1.3.jar > antlr_3.1.3_jar_out.txt (Note to others -- you need the "f" flag along with t, even tho you'd think that the f action would be default.) ... and it ran to completion fine, no errors, complete li

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

2009-08-08 Thread Graham Wideman
>You can use $rule.start and $rule.stop to get the start and end >tokens of the range matched by a rule, Ah-HAH! Yes that makes a lot of sense, and obvious now that you point it out. Thanks! > you need to be careful if the rule can successfully match no >tokens at all (or not the one you're

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

2009-08-08 Thread Graham Wideman
Hi Tomasz and all, Coincidentally I too am puzzling over this topic, and blundered into error(117) just yesterday.  So at the very least, you can feel like you have company :-) The basic issue is what the arguments to -> ^(NEWTOKEN[args] are expected to be (ie: their types) and where such args c

[il-antlr-interest: 25092] [antlr-interest] Bug? Line number off in generate lexer

2009-08-07 Thread Graham Wideman
" group. To post to this group, send email to il-antlr-interest@googlegroups.com To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~--~~~--

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

2009-08-06 Thread Graham Wideman
Hi Sam: >I'd lex $id and id entirely separately, as they are syntactically >distinct entities. $blah is always a variable, a "true" variable, Tempting, but not necessarily the immediate winner because PHP also allows things like: $myvar = 'othervar'; $$myvar = 'xxx'; ... which means

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

2009-08-06 Thread Graham Wideman
Hi Sam, Thanks for your comments. More below on your questions: >I'm curious as to why you want to sometimes consider whitespace, though. >Is this a self-designed language, or a specification you're working from >that makes whitespace 'sometimes' significant? > >You example was a function call

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

2009-08-05 Thread Graham Wideman
de will need to be included in the relevant rules to look at the hidden channel etc. OK, I think this is clear to me now. Back to the regularly scheduled programming... Thanks again,   Graham At 8/5/2009 07:38 PM, Gerald Rosenberg wrote: At 07:00 PM 8/5/2009, Graham Wideman wrote: Hi Lorin

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

2009-08-05 Thread Graham Wideman
Hi Loring Thanks for your comments. So when you say that "ANTLR makes no assumptions", I take that to mean ANTLR makes these assumptions: a) whitespace is permitted between any tokens. b) whitespace can be omitted between tokens so long as the beginning of the subsequent string doesn't make t

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

2009-08-05 Thread Graham Wideman
Hi folks: Could someone clue me in to the zen of whitespace (or where this is discussed in The Books or online)? By that I mean as follows: I see that grammars generally have a lexer rule that specifies the pattern for whitespace, but what's the correspondence between that and what ANTLR doe

[il-antlr-interest: 24610] Re: [antlr-interest] ST feature proposal

2009-07-10 Thread Graham Wideman
Gerald rightly observed that... >Given that ST tends to preserve whitespace, the least change rule >would be to preserve any whitespace immediately prior to the <\\> ... and also the whitespace preceding the <\\> is easy to see. So this indeed seems to satisfy the issue of how to specify whit

[il-antlr-interest: 24601] Re: [antlr-interest] ST feature proposal

2009-07-10 Thread Graham Wideman
Hi Ter, At 7/10/2009 11:42 AM, Terence Parr wrote: >Hi Graham, yep, i wonder if we need both "ignore newline" and "ignore >newline and indentation". Actually, Ignore \n without ignoring >whitespace doesn't make any sense because without a \n there is no >indentation ;) >I think <\\> should

[il-antlr-interest: 24588] Re: [antlr-interest] ST feature proposal

2009-07-09 Thread Graham Wideman
Hi Ter, Idea looks attractive to me. Comments: > Perhaps we need another special symbol that means > allow me to do a newline and it didn't the next line, > but don't put it into the output. "it didn't" probably = "indent"? So basically, the double-backslash expression means ignore subsequen

[il-antlr-interest: 24356] Re: [antlr-interest] How to get and use AST after parse error?

2009-06-24 Thread Graham Wideman
At 6/24/2009 05:12 PM, you wrote: >You will probably need to add exception {} > >To your rules but most common reason fir getting a single error node >is that you rules need reorganizing so they don't throw an exception >that nulls out the entire tree when an error is detected, just the >tre

[il-antlr-interest: 24354] [antlr-interest] How to get and use AST after parse error?

2009-06-24 Thread Graham Wideman
Folks -- I'd appreciate if someone could straighten me out on what is The Intended Way on the following issue: I'm working on a PHP grammar that produces an AST, testing it against various source code. When a parse succeeds, I get a nice AST returned from PhpParser.prog() via prog_return.

[il-antlr-interest: 24005] Re: [antlr-interest] Reverse Iterate over String Template

2009-06-03 Thread Graham Wideman
Hi Christian: > Is there a way to iterate over a string template in reverse order? Until Ter implements list reverse, you might try something like this to apply a template to a list in reverse order: -- maintemplate(arg1) ::= << >> rev(argR) ::= << >> use

[il-antlr-interest: 23899] Re: [antlr-interest] A php grammar

2009-05-27 Thread Graham Wideman
Excellent! Looking forward to trying that out in the next few days. -- Graham At 5/27/2009 05:04 PM, you wrote: Hi,  I've written a grammar file for parsing parsing php source. You can download it at http://phpparser.googlecode.com/files/Php.g Have a look at http://code.google.com/p/phpparser