essentially the
former as an example of why LL(*) makes it so you don't have to do a manual
refactoring such as the latter. In fact, that section makes the argument
that one should *not* do the left-factoring manually, if for no other reason
than to maintain the readability of the gramma
is doesn't:
pointer
: (lc='*' type_qualifier?)+ -> ^(POINTER[$lc, "POINTER"]
type_qualifier?)+
;
Does the latter work in the latest snapshots?
Thanks,
--
Gary R. Van Sickle
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Nerd Points. += 1,000,000 points if that's actually what
he meant.
;-)
--
Gary R. Van Sickle
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--~--~-~--~~~---~--~-
> At 17:58 22/05/2009, Gary R. Van Sickle wrote:
> >var_decl_list
> >: TYPENAME ids+=IDENTIFIER (',' ids+=IDENTIFIER)* -> ^(VAR_DECL
> >TYPENAME IDENTIFIER)+
> >;
> >
> >If your rule can't be reduced to a one-liner like
NTIFIER)+
;
If your rule can't be reduced to a one-liner like that though (e.g. C
declarations), things quickly get complicated, and I've yet to determine a
good, general way of handling it. You'll probably want to look into ANTLR
p there is an imaginary token that I can't do the
"$lc" thing to because they derive from nonterminals. This is using "ANTLR
Parser Generator Version 3.1.4-SNAPSHOT Mar 31, 2009 24:26:37" and the
latest 3.1.3 C runtime.
Any idea what's going wrong? Is it me or ANTLR?
for return values (declaration only), and not encountered any
> issues in my grammars thus far.
>
> Richard
Like I noted above, you will run into problems due to the malloc() vs. new
thing. At least I did the last time I tried it.
--
Gary R. Van Sickle
List: http:
e. Custom build rules are done on a
> per-target basis (which sucks, I'll admit), you have to
> specify an expression to match the filename, you provide a
> script to do the work, and you specify output files.
>
Similar issue with bog-standard makefiles. Though like anythi
--
Gary R. Van Sickle
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
27;t see the rationale stated anywhere). This way
the existing syntax and semantics stay the same, so nobody's existing
parsers get broken, and by adopting the same syntax/symantics of Perl
regexes, we creep ever closer to the day when we can all use these glorious
regexes in our ANTLR l
" that this could be reduced in the input grammar? Even if "L" here
is not a terminal but is intended to be either a terminal or non-terminal,
aren't these two variations in all cases exactly equivalent?
--
Gary R. Van Sickle
List: http://www.antlr.org/mailman/listinfo/antlr-inte
ppear to work:
pointer
: POINTER
;
But it's not clear to me why this should be so. Shouldn't both these cases
share the same syntax, either both ^(POINTER) or both POINTER?
Thanks,
--
Gary R. Van Sickle
List: http://www.antlr.org/mailman/listinfo/antlr-inte
matches what's on page 134 of the ANTLR book. So, never mind.
--
Gary R. Van Sickle
> -Original Message-
> From: antlr-interest-boun...@antlr.org
> [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Gary
> R. Van Sickle
> Sent: Saturday, February 28, 2009
en? If I comment out the action, it gets through ANTLR and compiles,
but of course that's of little use. Apparently ANTLR is looking for
something along the lines of "new If(NULL, $something::s1, $something::s2)",
but I have no idea what $something is supposed to be, nor can I fin
;
>
> And then use p+=content in your original rule.
Bug or feature though? It seems inconsistent for what appear to be two
semantically equivalent constructs to be totally fine in the one case and a
silent failure in the other.
--
Gary R. Van Sickle
List: http://www.antlr.org/mai
nal_declaration)>->free(SCOPE_TOP(external_declaration));
}
Not quite sure what's going on there, but in the first case it looks like
there's one too few "-"'s and in the second one too many ">"'s before the
"free".
--
Gary R. Van Sic
sing an "lc=" anywhere. When the resulting parser
is run, it segfaults. Seems to me that ANTLR should refuse to compile this.
--
Gary R. Van Sickle
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.
: Unexpected token, at offset 12
near [Index: 6 (Start: 8980854-Stop: 8980870) ='THIS_IS_A_TYPEDEF',
type<39> Line: 2 LinePos:12]
: syntax not recognized...
Doing "ds=" results in the same problem. Am I misunderstanding something,
or is this breakage?
--
Gary R. Van
structs used for these purposes are malloc()'ed, hence no
object construction.
Hmmm
"#ifdef __cplusplus
// We're being compiled as C++
NEW_SCOPE new ScopeStruct()
#else
// We're in C
NEW_SCOPE malloc(sizeof(ScopeStruct))
#endif
ScopeStruct the_scope = NEW_SCOPE
s aren't able to read release notes yet, nor are they in
general able to divine the version of a language the original source was
written to. Until they somehow magically grow both these abilities,
everybody wins if such information is explicitly communicated by the writer
to the tool.
> S
> From: Anthony W. Youngman
>
> In message <673774b77dfb453c985a9d7053ec2...@dfw5rb41>, Gary
> R. Van Sickle writes
> >> Another improvement would be to allow a comma-separated list.
> >> With it one can record all versions of ANTLR, with which
&
;-) PLease make sure
> that the build you download includes these changes, which it
> should be build #20 for the C runtime and build #49 for the
> ANTLR Tool.
>
> Jim
> - - - - -
>
Can't speak to the speed, but the Pop() thing is solved here. Thanks
97
): undefined reference to `_pcompound_statement_SymbolsPop'
collect2: ld returned 1 exit status
make: *** [all] Error 1
--
Gary R. Van Sickle
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/ant
t; and so on all within the jar. You can tehrefore run it
> without CLASSPATH as:
>
> jar -jar path/to/jar-with-dependencies.jar t.g
^^^
java -jar [etc]
--
Gary R. Van Sickle
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/o
tion_unit_return translation_unit() throws
RecognitionException {
Symbols_stack.push(new Symbols_scope());
[...]
finally {
[...]
Symbols_stack.pop();
}
return retval;
}
// $ANTLR end "translation_unit"
--
Gary
icated with "ANTLR Parser Generator Version
3.1.2-2008-10-21" and libantlr3c-3.1.2.b1.tar.gz from here:
<http://www.antlr.org/hudson/job/ANTLR%20C%20Runtime/lastSuccessfulBuild/art
ifact/libantlr3c-3.1.2.b1.tar.gz>
Is there something else I can do to try help debugging this?
--
G
AST lines and it builds fine.
>
> ???
>
> > Jim
> >
Replicated this with "ANTLR Parser Generator Version 3.1.2-2008-10-21"
and... I'm not sure which version of runtime, Makefile.am is dated 10/1/08.
--
Gary R. Van Sickle
List: http://www.antlr.org/mailman/
behaviour or the use of a new feature), the list is cleared.
How do you do that once your grammar leaves your PC? Your customer decides
to upgrade his ANTLR install and now your program won't compile.
> And if someone is unsure if a grammar change makes things
> incompatible, he has to chec
s work fine if I don't declare
"output=AST"; in that case, the only SymbolsPop() function generated or
called appears to be pss9_combined_lexer_parserParser_SymbolsPop(), i.e. all
dynamic scope code calls the same ScopePop(). Does this ring any bells for
anybody?
--
Gary R. Van Sickle
;;
> }
>
FWIW, when I become King Of The World, all languages will require such an
indication of what version they were written for.
--
Gary R. Van Sickle
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr
9/C0x constructs.
I ran into this one myself, and temporarily got around it by simply
"absorbing" anything that looked like "__extension__ ( )".
>
> 3:
>
> Token *pToken = __builtin_va_arg(ap, Token*);
>
Same thing here, __builtin_va_arg() is a GCC built-in that
ression::root}
{$te.root_identifier}) tree_expression
// This handles everything else.
| IDENTIFIER -> ^(ASSOCIATION {$tree_expression::root} IDENTIFIER)
;
//@}
Are there better or more succinct ways to do what I'm trying to do here?
--
Gary R. Van Sickle
> -Ori
//@}
I have an analogous construct in a different part of my grammar which does
this same thing with a pANTLR3_BASE_TREE, with no observed ill effect.
--
Gary R. Van Sickle
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr
rrent "lex 'em all and let the parser sort
'em out" lexer implementation used by ANTLR results in a system which
needlessly suffers the limitations involved with the top-down approach and
prevents it from taking advantage of some of the benefits.
Idle New Years' Eve thinking-out-lo
omplex and/or
sloppy the specification of the language in question is. Parsing HTML with
tools such as ANTLR should be a relatively straightforward endeavor.
> Any suggestions, advice or pointers gladly appreciated!
> Thanks,
> Tom
Hope this helps Tom.
--
Gary R. Van Sickle
List: http:
EUR' ;
TNE : 'TNE' ;
Parser does something like this:
num_with_monetary_unit_and_optional_per_unit
: NUMBER monetary_unit ('/' measurement_unit)?
;
monetary_unit
: EUR
| <>
;
measurement_unit
: TNE
| <>
;
But was that really your question?
--
G
> From: Gavin Lambert
>
> At 22:17 25/12/2008, Gary R. Van Sickle wrote:
> >translation_unit
> >: (BOL statement EOL)+
> >;
> >
> >You'd have to be throwing up WS tokens as well though for
> >that to be buying you anything.
>
&
L implies a BOL (beginning of line)
immediately after it, so "simply" emit both an EOL and a BOL token from the
('\r'|'\n')+ match in the lexer, then make your parser rules look like this:
translation_unit
: (BOL statement EOL)+
;
You'd have to be throwin
about
things like Java: "$id.text" => C: "$id.text->chars", maybe in nice tables,
one for each "Java Target => LanguageX Target" mapping. I know this may be
a quickly moving target, so maybe make it a web-only thing and direct people
to it in the book.
Here'
> From: Jim Idle
>
> On Mon, 2008-12-15 at 08:44 -0600, Gary R. Van Sickle wrote:
>
>
> Hi all,
>
> Not sure if this is something that should be obvious or
> not, but is there a
> way, completely in ANTLR 3.x (C backend
t varA) (VAR_DECL int varB) (VAR_DECL int varC)
Of course once I have the AST I can traverse it with C &&/|| C++, but it
would sure be nice if ANTLR was able to flatten these sort of constructs for
me.
Thanks,
--
Gary R. Van Sickle
List: http://www.antlr.org:8080/mailman/listinfo
> From: Jim Idle
>
> On Mon, 2008-12-01 at 22:17 -0600, Gary R. Van Sickle wrote:
>
>
> Shouldn't this:
>
> ANTLR3_API pANTLR3_INPUT_STREAM
> antlr3AsciiFileStreamNew(pANTLR3_UINT8
> fileNam
Shouldn't this:
ANTLR3_API pANTLR3_INPUT_STREAM antlr3AsciiFileStreamNew(pANTLR3_UINT8
fileName);
Really be this:
ANTLR3_API pANTLR3_INPUT_STREAM antlr3AsciiFileStreamNew(const
pANTLR3_UINT8 fileName);
?
--
Gary R. Van Sickle
List: http://www.antlr.org:8080/mailman/listinfo/
> From: Jim Idle
>
> On Sun, 2008-11-30 at 03:06 -0600, Gary R. Van Sickle wrote:
>
>
> > From: Jim Idle
> >
> > On Fri, 2008-11-28 at 21:28 -0600, Gary R. Van Sickle wrote:
> >
>
en
able to determine, there simply isn't any support in the distribution for
even rudimentary installation and command-line use. See my last post, I'd
be more than happy to contribute my solution if there's any interest in it.
--
Gary R. Van Sickle
List: http://www.antlr.org:8
> From: Jim Idle
>
> On Fri, 2008-11-28 at 21:28 -0600, Gary R. Van Sickle wrote:
>
>
> Hi Terence et al,
>
> Am I just getting old, or shouldn't I be able to (in a
> More Ideal World(tm),
> of course) do som
that looks like part of
an URL?
Am I missing something blindingly obvious? Is there a reason for the
current state of affairs? If it's a matter of Makefile/shell-script-fu, I
can help out in that area.
--
Gary R. Van Sickle
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
U
47 matches
Mail list logo