Jim,
Thanks for the suggestion. But
programmatic_unit
: simple_name a b
;
a // line 12
: (STAR simple_name )+
(SLASH simple_name)*
| (SLASH simple_name)*
;
b
:
( (STAR)
INT)?
;
simple_name
: NAME_FRAG
((SPACE)? NAME_FRAG)*
;
Introduces additional warnings:
Foo.g:12: warning:nondeterminism between alts 1 and 2 of block upon
Foo.g:12: k==1:STAR
Foo.g:12: k==2:NAME_FRAG
Foo.g:13: warning:nondeterminism upon
Foo.g:13: k==1:STAR
Foo.g:13: k==2:NAME_FRAG
Foo.g:13: between alt 1 and exit branch of block
And it doesn't express what I need. The grammar has to accept these
examples:
a
a*b
a*b/c
a*b/c*2
a/c
a/c*2
This is a subset of a larger grammar, from DMTF DSP0004, that insists the
programmatic units value consists of named multiplicative factors followed
by named divided factors followed by constant multiplicative factors, e.g.
"byte", "second * 250 * 10^-9", "foot * foot * foot / minute", "second *
250 * 10^-9"
Mike
IBM
(919) 732-5020
From:
Jim Idle <[email protected]>
To:
Cc:
[email protected]
Date:
01/14/2009 01:39 PM
Subject:
Re: [antlr-interest] Newbie Help
Mike Gering wrote:
Gavin,
Thanks for the suggestion, but no value of k will work because the grammar
accepts an optional list of tokens between (STAR simple_name)* and "b".
For example:
x*x*x*y/y/y*z
should be accepted. The series of slash terms can be arbitrarily long or
absent.
I think that you want:
a
: (STAR simple_name )+ (SLASH simple_name)*
| (SLASH simple_name)*
;
If you can use ANTLR 3.1 instead you will find this a lot easier.
Jim
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address