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
--~--~-~--~~--
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
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
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
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
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
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
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
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.
--
bute
>: GENERIC_ID WS? '=' WS? VALUE
>
>;
>
>end_tag
>: ''
>
>;
>
>comment
> : ''
> ;
>
>cdata
> : ''
> ;
>
>
>
>GENERIC_ID
>: ( LETTER | '_' | &
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
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
(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
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
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:
-
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
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
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
>
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
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
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
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,".."] $
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
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!)
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.
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
>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
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
" 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
-~--~~~--
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
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
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
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
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
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
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
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
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
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.
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
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
41 matches
Mail list logo