Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

antlr-interest · ANTLR Interest List [moved]

The Yahoo! Groups Product Blog

Check it out!

Group Information

? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

Advanced
Messages Help
Messages 8451 - 8480 of 14630   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#8451 From: Dave Makalsky <dm@...>
Date: Mon Jun 2, 2003 3:02 am
Subject: Good enough parsing
dmakalsky
Send Email Send Email
 
Hi:

I am looking for some examples of 'weak' parsers, i.e. parsers which
have error codes to continue parsing sections of code even after an error.

Could someone please point me at an ANTLR example?

Thanks,

Dave Makalsky

#8452 From: Ric Klaren <klaren@...>
Date: Mon Jun 2, 2003 7:25 am
Subject: Re: Application crashing on upgrading from 2.6.0 to 2.7.2
izniegoed
Send Email Send Email
 
On Fri, May 30, 2003 at 09:31:35PM -0000, monaabs wrote:
> I have switched to 2.7.2 . In function initLiterals() the application
> is crashing

Could it be that you're picking up the old version of the lib? I think I've
seen this before somewhere (try the archive). A clean recompile might help
as well.

Ric
--
-----+++++*****************************************************+++++++++-------
     ---- Ric Klaren ----- j.klaren@... ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
   Wo das Chaos auf die Ordnung trifft, gewinnt meist das Chaos, weil es
   besser organisiert ist. --- Friedrich Nietzsche

#8453 From: Ric Klaren <klaren@...>
Date: Mon Jun 2, 2003 7:27 am
Subject: Re: C++ has linking errors
izniegoed
Send Email Send Email
 
On Thu, May 29, 2003 at 10:24:54PM -0000, monaabs wrote:
> I invoked Antlr.dsw which is in ..\antlr\antlr-2.7.2\lib\cpp.

The dsw files are out of date. The DLL build is broken, try the archive for
a solution if you want to get that to work.

Ric
--
-----+++++*****************************************************+++++++++-------
     ---- Ric Klaren ----- j.klaren@... ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
   "I don't have anything against Java - it's the best damn implementation
               of UCSD Pascal ever released..." --- Larry Smith

#8454 From: Ric Klaren <klaren@...>
Date: Mon Jun 2, 2003 9:12 am
Subject: Re: problem of using default parameters in parser rules
izniegoed
Send Email Send Email
 
On Thu, May 22, 2003 at 04:58:41AM -0000, xdjicn wrote:
>    I want to use default parameters in parser rules,for example:
>
> parseRule1 [int iPos = 0]
> :
> .....
>
> but the codes generated by ANTLR redefined the default parameter:
>
> //in .hpp
> void Parser::parserRule1 (int iPos = 0);      //valid
>
> //in .cpp
> void Parser::parserRule1 (int iPos = 0)
> {
>   ...
> }
> //which is invalid
> Does anybody know how to solve the problem?

No solution at the moment other than not using them. Ran into it myself as
well.

Ric
--
-----+++++*****************************************************+++++++++-------
     ---- Ric Klaren ----- j.klaren@... ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
   Wit is cultured insolence. --- Aristotle

#8455 From: "Jorge Scandaliaris" <j_scandaliaris@...>
Date: Mon Jun 2, 2003 1:27 pm
Subject: RE: Integration of antlr generated lexer-parser into a GUI app.
j_scandaliaris
Send Email Send Email
 
Thanks, fortunately I won't have to mess around too much with the MFC
gui, so if the antlr generated parser doesn't generate any adverse
side-effects everything should be OK.

Jorge

> -----Mensaje original-----
> De: Ian L. Kaplan [mailto:iank@...]
> Enviado el: viernes, 30 de mayo de 2003 18:49
> Para: j_scandaliaris@...
> Asunto: Re: [antlr-interest] Integration of antlr generated
lexer-parser
> into a GUI app.
>
>
> > I am in the process of integrating a lexer-parser (c++ output) into
> > an MFC GUI application (visual c++ 6).
> ...
> > Anybody has integrated antlr parsers into gui apps before? My c++
> > expertise is almost non-existent (not to mention visual c++, which I
> > just use as a compiler to generate console apps), but I recall
> > reading somewhere that some problems might arise due to use of
> > stderr, stdout, etc. I searched the message archive but with no
> > luck. I would appreciate if someone (not necessarily one :) )
>
>   I have never integrated ANTLR into a MFC GUI app, but I have
>   integrated other C++ code, including openGL codes.
>
>   I had a hard time with MFC until I really understood C++.  MFC
>   relies heavily on subclassing the MFC classes and over-riding
>   particular functions to supply your own functionality.
>
>   I don't actually think that the problem will be ANTLR so much as it
>   will be dealing with the MFC environment.  There is a big learning
>   curve there.
>
>   Ian

#8456 From: "monaabs" <monaabs@...>
Date: Mon Jun 2, 2003 4:00 pm
Subject: c++ exception on loading literals
monaabs
Send Email Send Email
 
Can someone please elaborate as to what i can do to solve the
crashing of my application on initLiteral["raw"] = 89. I am using
boost .

I went through the archive and came across this

On the off chance that this will help someone:

The problem is indeed with the DLL build, going to a static library
took care of the issue. I suspect it has to do with the allocators
for the templates being in a different memory space than the
templates themsevles, but that's a theory I don't have time to test.

Going the static library route works, so long as the code generation
for the lib is the same as the code generation for the application
using it. (IE: both single threaded, or both multi threaded etc.)

#8457 From: Terence Parr <parrt@...>
Date: Mon Jun 2, 2003 4:52 pm
Subject: Re: Error in 2.7.2
parrt2000
Send Email Send Email
 
On Friday, May 30, 2003, at 06:06  PM, Matthew Ford wrote:

> I downloaded 2.7.2 final.  There is an error in the ANTLR Parser
>
> I am getting the following error
>     [antlr] ANTLR Parser Generator   Version 2.7.2   1989-2003
> jGuru.com
>     [antlr] C:\temp\antlrTest\links.g:107: warning:lexical
> nondeterminism
> between alts 1 and 2 of block upon
>     [antlr] C:\temp\antlrTest\links.g:107:
> k==1:'\t','\n','\u000c','\r',' '
>     [antlr] C:\temp\antlrTest\links.g:107:     k==2:<end-of-token>
>
> with (full code below)
>
> protected
> SCARF
>  : WS // track line numbers while you scarf
>  | . {}
>  ;
>
> while
> protected
> SCARF
>  : WS // track line numbers while you scarf
>  | .
>  ;
>
> gives no errors

Ah.  Yes, i use "is wildcard alone in the alt" rather than a more
intelligent but more difficult version that ignores actions.  Sorry
about that. :(  You can just put into a subrule and then put action at
the end.

Ter
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Co-founder, http://www.peerscope.com link sharing, pure-n-simple
Lecturer in Comp. Sci., University of San Francisco

#8458 From: Matthew Ford <Matthew.Ford@...>
Date: Mon Jun 2, 2003 10:50 pm
Subject: Re: Error in 2.7.2
Matthew.Ford@...
Send Email Send Email
 
Hi Ter,
Could you provide the actual fix please.

I tried the following but got the same error (Note: WS does it own printing)

protected
SCARF
   :( WS // track line numbers while you scarf
  | a:ALL_THE_REST
  ) {if (a!=null) {output.print(a);}}
  ;

protected
ALL_THE_REST
  : .
  ;

----- Original Message -----
From: "Terence Parr" <parrt@...>
To: <antlr-interest@yahoogroups.com>
Sent: Tuesday, June 03, 2003 2:52 AM
Subject: Re: [antlr-interest] Error in 2.7.2


>
> On Friday, May 30, 2003, at 06:06  PM, Matthew Ford wrote:
>
> > I downloaded 2.7.2 final.  There is an error in the ANTLR Parser
> >
> > I am getting the following error
> >     [antlr] ANTLR Parser Generator   Version 2.7.2   1989-2003
> > jGuru.com
> >     [antlr] C:\temp\antlrTest\links.g:107: warning:lexical
> > nondeterminism
> > between alts 1 and 2 of block upon
> >     [antlr] C:\temp\antlrTest\links.g:107:
> > k==1:'\t','\n','\u000c','\r',' '
> >     [antlr] C:\temp\antlrTest\links.g:107:     k==2:<end-of-token>
> >
> > with (full code below)
> >
> > protected
> > SCARF
> >  : WS // track line numbers while you scarf
> >  | . {}
> >  ;
> >
> > while
> > protected
> > SCARF
> >  : WS // track line numbers while you scarf
> >  | .
> >  ;
> >
> > gives no errors
>
> Ah.  Yes, i use "is wildcard alone in the alt" rather than a more
> intelligent but more difficult version that ignores actions.  Sorry
> about that. :(  You can just put into a subrule and then put action at
> the end.
>
> Ter
> --
> Co-founder, http://www.jguru.com
> Creator, ANTLR Parser Generator: http://www.antlr.org
> Co-founder, http://www.peerscope.com link sharing, pure-n-simple
> Lecturer in Comp. Sci., University of San Francisco
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>

#8459 From: Terence Parr <parrt@...>
Date: Mon Jun 2, 2003 11:01 pm
Subject: Re: Error in 2.7.2
parrt2000
Send Email Send Email
 
Hi.  I was thinking subrule not another rule (though the word seems to
work for either case) ;)

Try this:

SCARF : ( WS | a:. ) {if (a!=null) {output.print(a);}} ;

Ter

On Monday, June 2, 2003, at 03:50  PM, Matthew Ford wrote:

> Hi Ter,
> Could you provide the actual fix please.
>
> I tried the following but got the same error (Note: WS does it own
> printing)
>
> protected
> SCARF
>   :( WS // track line numbers while you scarf
>  | a:ALL_THE_REST
>  ) {if (a!=null) {output.print(a);}}
>  ;
>
> protected
> ALL_THE_REST
>  : .
>  ;
>
> ----- Original Message -----
> From: "Terence Parr" <parrt@...>
> To: <antlr-interest@yahoogroups.com>
> Sent: Tuesday, June 03, 2003 2:52 AM
> Subject: Re: [antlr-interest] Error in 2.7.2
>
>
>>
>> On Friday, May 30, 2003, at 06:06  PM, Matthew Ford wrote:
>>
>>> I downloaded 2.7.2 final.  There is an error in the ANTLR Parser
>>>
>>> I am getting the following error
>>>     [antlr] ANTLR Parser Generator   Version 2.7.2   1989-2003
>>> jGuru.com
>>>     [antlr] C:\temp\antlrTest\links.g:107: warning:lexical
>>> nondeterminism
>>> between alts 1 and 2 of block upon
>>>     [antlr] C:\temp\antlrTest\links.g:107:
>>> k==1:'\t','\n','\u000c','\r',' '
>>>     [antlr] C:\temp\antlrTest\links.g:107:     k==2:<end-of-token>
>>>
>>> with (full code below)
>>>
>>> protected
>>> SCARF
>>>  : WS // track line numbers while you scarf
>>>  | . {}
>>>  ;
>>>
>>> while
>>> protected
>>> SCARF
>>>  : WS // track line numbers while you scarf
>>>  | .
>>>  ;
>>>
>>> gives no errors
>>
>> Ah.  Yes, i use "is wildcard alone in the alt" rather than a more
>> intelligent but more difficult version that ignores actions.  Sorry
>> about that. :(  You can just put into a subrule and then put action at
>> the end.
>>
>> Ter
>> --
>> Co-founder, http://www.jguru.com
>> Creator, ANTLR Parser Generator: http://www.antlr.org
>> Co-founder, http://www.peerscope.com link sharing, pure-n-simple
>> Lecturer in Comp. Sci., University of San Francisco
>>
>>
>>
>>
>> Your use of Yahoo! Groups is subject to
>> http://docs.yahoo.com/info/terms/
>>
>>
>
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Co-founder, http://www.peerscope.com link sharing, pure-n-simple
Lecturer in Comp. Sci., University of San Francisco

#8460 From: "Matthew Ford" <Matthew.Ford@...>
Date: Mon Jun 2, 2003 11:06 pm
Subject: Re: Error in 2.7.2
Matthew.Ford@...
Send Email Send Email
 
Yes that worked thanks.
That bit of magic should go in the docs or the FAQ's

----- Original Message -----
From: "Terence Parr" <parrt@...>
To: <antlr-interest@yahoogroups.com>
Sent: Tuesday, June 03, 2003 9:01 AM
Subject: Re: [antlr-interest] Error in 2.7.2


> Hi.  I was thinking subrule not another rule (though the word seems to
> work for either case) ;)
>
> Try this:
>
> SCARF : ( WS | a:. ) {if (a!=null) {output.print(a);}} ;
>
> Ter
>
> On Monday, June 2, 2003, at 03:50  PM, Matthew Ford wrote:
>
> > Hi Ter,
> > Could you provide the actual fix please.
> >
> > I tried the following but got the same error (Note: WS does it own
> > printing)
> >
> > protected
> > SCARF
> >   :( WS // track line numbers while you scarf
> >  | a:ALL_THE_REST
> >  ) {if (a!=null) {output.print(a);}}
> >  ;
> >
> > protected
> > ALL_THE_REST
> >  : .
> >  ;
> >
> > ----- Original Message -----
> > From: "Terence Parr" <parrt@...>
> > To: <antlr-interest@yahoogroups.com>
> > Sent: Tuesday, June 03, 2003 2:52 AM
> > Subject: Re: [antlr-interest] Error in 2.7.2
> >
> >
> >>
> >> On Friday, May 30, 2003, at 06:06  PM, Matthew Ford wrote:
> >>
> >>> I downloaded 2.7.2 final.  There is an error in the ANTLR Parser
> >>>
> >>> I am getting the following error
> >>>     [antlr] ANTLR Parser Generator   Version 2.7.2   1989-2003
> >>> jGuru.com
> >>>     [antlr] C:\temp\antlrTest\links.g:107: warning:lexical
> >>> nondeterminism
> >>> between alts 1 and 2 of block upon
> >>>     [antlr] C:\temp\antlrTest\links.g:107:
> >>> k==1:'\t','\n','\u000c','\r',' '
> >>>     [antlr] C:\temp\antlrTest\links.g:107:     k==2:<end-of-token>
> >>>
> >>> with (full code below)
> >>>
> >>> protected
> >>> SCARF
> >>>  : WS // track line numbers while you scarf
> >>>  | . {}
> >>>  ;
> >>>
> >>> while
> >>> protected
> >>> SCARF
> >>>  : WS // track line numbers while you scarf
> >>>  | .
> >>>  ;
> >>>
> >>> gives no errors
> >>
> >> Ah.  Yes, i use "is wildcard alone in the alt" rather than a more
> >> intelligent but more difficult version that ignores actions.  Sorry
> >> about that. :(  You can just put into a subrule and then put action at
> >> the end.
> >>
> >> Ter
> >> --
> >> Co-founder, http://www.jguru.com
> >> Creator, ANTLR Parser Generator: http://www.antlr.org
> >> Co-founder, http://www.peerscope.com link sharing, pure-n-simple
> >> Lecturer in Comp. Sci., University of San Francisco
> >>
> >>
> >>
> >>
> >> Your use of Yahoo! Groups is subject to
> >> http://docs.yahoo.com/info/terms/
> >>
> >>
> >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> --
> Co-founder, http://www.jguru.com
> Creator, ANTLR Parser Generator: http://www.antlr.org
> Co-founder, http://www.peerscope.com link sharing, pure-n-simple
> Lecturer in Comp. Sci., University of San Francisco
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>

#8461 From: "tanbunsarenice2" <tanbunsarenice2@...>
Date: Tue Jun 3, 2003 5:16 am
Subject: stop staring at your coworkers tits
tanbunsarenice2
Send Email Send Email
 
Take our free trial to our dating directory of over a million members looking 
for no-strings attached sex. Our dating site contains
pics,vids,chats,games,questionaires, and directories to the best swing clubs
around. Your bound to finally get laid instead always staring for nothing!

http://www.nakedfriendfinder.com/landing.asp?afl=MYHO

#8462 From: "madison_stjames" <madison_stjames@...>
Date: Tue Jun 3, 2003 5:24 am
Subject: ANTLR Matching Behavior
madison_stjames
Send Email Send Email
 
Can you use the "dot" notation in ANTLR?

For example, can I write something like (.) - match anything
or (.){1-3) - one to three of any one character.

I couldn't find this information in the docuentation.

Thanks!
~msj

#8463 From: Ric Klaren <klaren@...>
Date: Tue Jun 3, 2003 11:13 am
Subject: Re: ANTLR Matching Behavior
izniegoed
Send Email Send Email
 
On Tue, Jun 03, 2003 at 05:24:29AM -0000, madison_stjames wrote:
> Can you use the "dot" notation in ANTLR?

Yes. Lexer and Treeparsers support it for sure.. Parser I'm not sure about.
Think it is hidden in the docs somewhere (I hope).

> For example, can I write something like (.) - match anything
> or (.){1-3) - one to three of any one character.

The {1-3} thing you have to implement manually in actions or other checks.

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
     ---- Ric Klaren ----- j.klaren@... ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
   "Of all the things i've lost i miss my mind the most -Ozzy Osbourne

#8464 From: "monaabs" <monaabs@...>
Date: Tue Jun 3, 2003 8:27 pm
Subject: 2.7.2 dsp and dsw
monaabs
Send Email Send Email
 
Greetings!!!!!!

While switching from 2.6.0 to 2.7.2 i encountered some problems in
building a dll .
Also from the archives , i noticed that Java code is managed better
than c++ .
Can somebody who has used vc 6.0 with ANTLR 2.7.2 guide me as to from
where i can get the proper files (dsp, dsw) . The one which is there
in downloads is pretty outdated .
Also what code changes do i have to make in order for 2.7.2 to work
wth vc++ 6.0.

Your inputs are highly appreciated.

#8465 From: iank@...
Date: Tue Jun 3, 2003 10:04 pm
Subject: Re: More on ANTLR 2.7.2, VC++ 6.0 and portability
iank@...
Send Email Send Email
 
I too have been making the transition to Antlr 2.7.2.  I've never
   been a big fan of Microsoft DLLs, so I've created a static link
   (e.g., a .lib).  I'd do this even if I could build the DLL.  Nor do
   I use the IDE project builder for building something like this.
   Note that Microsoft most certainly does not build large software
   components this way either.  They use and I use nmake, which is
   Microsoft's mutated version of UNIX make.

   I'm in the process of rewriting my ANTLR tutorial web pages, so I
   have not published the new nmake file yet.  If you need it before I
   get to it, send me a note.  I picked up a few additional changes to
   reduce the number of warnings and to allow the software to build
   from the ANTLR yahoo groups archive.  This was a change to one file
   (antlr/config.h?)  I can send you the modified source files as well.

   The other surprising experience I had is that a simple test grammar
   (e.g., my expression grammar) and its associated "main" no longer
   ran properly.  Some of this had to do with the way the AST factory
   is initialized (I picked this up from the examples).  However there
   seem to be grammar based problems as well (no grammar errors or
   warnings, but the grammer works differently now).  So the transition
   has not been as painless as I had hoped.  My fear now is that a
   large Java language grammar/AST generation front end I have will not
   port painlessly either.  Since this weighs in at about 5K lines of
   comments, grammar and C++ code this is sort of scary.

   Perhaps the way to summarize it is that the good news is that great
   people like Terance, Ric K. and others are active ANTLR developers
   and ANTLR is evolving.  That's the bad news too when you go to a new
   release, even when it is "new and improved".

   Ian
   www.bearcave.com

#8466 From: Ric Klaren <klaren@...>
Date: Wed Jun 4, 2003 8:55 am
Subject: Re: Re: More on ANTLR 2.7.2, VC++ 6.0 and portability
izniegoed
Send Email Send Email
 
On Tue, Jun 03, 2003 at 03:04:33PM -0700, iank@... wrote:
>   The other surprising experience I had is that a simple test grammar
>   (e.g., my expression grammar) and its associated "main" no longer
>   ran properly.  Some of this had to do with the way the AST factory
>   is initialized (I picked this up from the examples).

It's in the C++ docs as well.. at least in the ones in the repository this
is documented.

>  However there seem to be grammar based problems as well (no grammar errors
>  or warnings, but the grammer works differently now).  So the transition
>  has not been as painless as I had hoped.

Could you elaborate on this?

>   and ANTLR is evolving.  That's the bad news too when you go to a new
>   release, even when it is "new and improved".

I just shipped off a snapshot to some MSVC users I know. I hope the DLL and
static build will work now. Also configure/make build should now be in sync
with the new java stuff.

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
     ---- Ric Klaren ----- j.klaren@... ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
   "You can't expect to wield supreme executive power just because some
    watery tot throws a sword at you!"
   --- Monty Python and the Holy Grail

#8467 From: "pamlookalike28" <pamlookalike28@...>
Date: Wed Jun 4, 2003 9:14 am
Subject: who wants to fuck me?anyone?
pamlookalike28
Send Email Send Email
 
I have no inhibitions and no gag reflex. Im pretty sexy too. dont beleive me?
you probaly think this is spam or something. We'll I can prove I need your cock.
Check out my uncensored personal ad for free under "summer01" and youll know I'm
real when Im riding your cock hard as hell
http://www.seductivesingles.net/landing.asp?afl=MYHO

#8468 From: "pcristip" <pcristip@...>
Date: Wed Jun 4, 2003 1:47 pm
Subject: yet another syntactic predicate problem
pcristip
Send Email Send Email
 
Hi,

I'd really appreciate some help on the following problem:

I have a grammar that is supposed to parse the body of a html file,
and everything is ok except the fact that the data between the tags
should be of two kinds:
1. a topic which is normal text except that it should start with a
letter (in fact only a through e letters) followed by a '.' char
(e.g." A.")
2. normal cdata which is the case if the text is not a topic

I managed to make this work except for the case when the text starts
with spaces.

Now I have something like:
(in the parser)
topic  : TOPICID^ topicbody
			 ;

topicbody :
				 ( options { greedy=true; }
					 :
					 text | font
				 )*
			 ;
text  : PCDATA ;


(in the lexer)

TOPICID
			 :
				 ('a' | 'b' | 'c' | 'd' | 'e') '.'
			 ;


PCDATA
			 :
				 ({ LA(2)!='.' }?
('a'|'b'|'c'|'d'|'e')) | ~('a'|'b'|'c'|'d'|'e'|'<'|'>')
				 (
					 options {

	 generateAmbigWarnings=false;
					 }
				 : '\r' '\n'
	 {newline();}
				 | '\r'
	 {newline();}
				 | '\n'
	 {newline();}
				 | ~('<'|'\n'|'\r'|'"'|'>')
				 )*
			 ;


which works ok for texts like "A. some text here" and "A normal text"
but if there are spaces in front like "   B. title" then the text is
matched as data not as a topic.

I tried to solve this by modifing the topic rule but no luck. And
thought that the best solution would be to use syntactic predicates
because the lookahead is not fixed in this case (the number of spaces
can be arbitrary before you can tell which rule to match).
So I got to this construct:

topic_or_answer : ((spaces)? TOPICID) => topic
                 |  text
                 ;

spaces          : WS ;

(and in lexer)
protected
WS 	 : (
					 options {

	 generateAmbigWarnings=false;
					 }
				 : ' '
				 | '\t'
				 | '\n' { newline(); }
				 | "\r\n" { newline(); }
				 | '\r' { newline(); }
				 )+
			 ;


which doesn't work (otherwise you wouldn't read these lines :) ).

Can someone give me a hint ? What did I do wrong ?

Thanks,
Chris

#8469 From: iank@...
Date: Wed Jun 4, 2003 4:31 pm
Subject: Re: ANTLR 2.7.2 portability
iank@...
Send Email Send Email
 
> It's in the C++ docs as well.. at least in the ones in the repository this
> is documented.

   I confess that I did not RTFM.  I rebuilt my old example and it
   crashed on an uninitialized object (e.g., this == 0).  So I looked
   at the examples.

> >  However there seem to be grammar based problems as well (no grammar errors
> >  or warnings, but the grammer works differently now).  So the transition
> >  has not been as painless as I had hoped.
>
> Could you elaborate on this?

   The example I've tried to rebuild is from my simple expression
   parser.  This is on my web page

      http://www.bearcave.com/software/antlr/antlr_examples.html

   I have not updated the "main.C" with my new code that properly
   initializes the AST Factory, so the supporting C++ which prints the
   tree is out of date.  I'm using the default AST construction.  The
   grammar is shown below.  The parser processes the left hand side
   identifier, the assignment and then nothing else.  I'm note sure why
   this is.  As I note on the web page, this used to work.  If it is
   not something blazingly obvious, please don't spend time on this.
   After all, I have not read the recent documentation changes and one
   should RTFM before asking for help.

   Ian



options {
	 language="Cpp";
}

class MyExprParser extends Parser;

options {
         k = 2;
         exportVocab=MyExpr;
	 buildAST = true;
}


exprlist
   : ( assignment_statement )* EOF!
   ;

assignment_statement
   : assignment SEMICOLON!
   ;

assignment
   : (IDENT ASSIGN )? expr
   ;

primary_expr
   : IDENT
   | constant
   | (LPAREN! expr RPAREN! )
   ;

sign_expr
   : (MINUS)? primary_expr
   ;

mul_expr
   : sign_expr (( TIMES | DIVIDE | MOD ) sign_expr)*
   ;

expr
   : mul_expr (( PLUS | MINUS ) mul_expr)*
   ;


constant
   : (ICON | CHCON)
   ;



class MyExprLexer extends Lexer;

options {
	 k = 2;
         exportVocab=MyExpr;
}


WS_     :       (' '
         |       '\t'
         |       '\n'
         |       '\r')
                 { _ttype = Token::SKIP; }
         ;

IDENT
options {
	 paraphrase = "identifier";
}
   :  ('a'..'z' | 'A'..'Z' | '_' ) ( ('a'..'z' | 'A'..'Z' | '_') |
('0'..'9' ))*
   ;

ICON
options {
	 paraphrase = "integer constant";
}
   : '0'..'9' ('0'..'9')*
   ;

CHCON
options {
	 paraphrase = "character constant";
}
   : "'" '\0'..'\255' "'"
   ;

COMMA
options {
	 paraphrase = ",";
}
   : ','
   ;

SEMICOLON
options {
	 paraphrase = ";";
}
   : ';'
   ;

LPAREN
options {
	 paraphrase = "(";
}
   : '('
   ;

RPAREN
options {
	 paraphrase = ")";
}
   : ')'
   ;

LCURL
options {
	 paraphrase = "{";
}
   : '{'
   ;

RCURL
options {
	 paraphrase = "}";
}
   : '}'
   ;

PLUS
options {
	 paraphrase = "+";
}
   : '+'
   ;

MINUS
options {
	 paraphrase = "-";
}
   : '-'
   ;

TIMES
options {
	 paraphrase = "*";
}
   : '*'
   ;

DIVIDE
options {
	 paraphrase = "/";
}
   : '/'
   ;

MOD
options {
	 paraphrase = "%";
}
   : '%'
   ;

ASSIGN
options {
	 paraphrase = "=";
}
   : '='
   ;

#8470 From: "Paul J. Lucas" <dude@...>
Date: Wed Jun 4, 2003 4:32 pm
Subject: Why does it silently ignore invalid input?
ypjl
Send Email Send Email
 
I have a grammar with a second entry-point that I call.  In my grammar,
"DECLARE" is
a keyword (must be upper-case).  When the generated parser encounters "declare"
(lower-case), it simply breaks out of the parse loop and returns.  Why doesn't
it throw
an exception?

#8471 From: Terence Parr <parrt@...>
Date: Wed Jun 4, 2003 5:01 pm
Subject: Re: Why does it silently ignore invalid input?
parrt2000
Send Email Send Email
 
If anything is optional and it doesn't find DECLARE, it will simply say
"matching 'nothing' is ok" :)

Ter

On Wednesday, June 4, 2003, at 09:32  AM, Paul J. Lucas wrote:

> I have a grammar with a second entry-point that I call.  In my
> grammar, "DECLARE" is
> a keyword (must be upper-case).  When the generated parser encounters
> "declare"
> (lower-case), it simply breaks out of the parse loop and returns.  Why
> doesn't it throw
> an exception?
>
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Co-founder, http://www.peerscope.com link sharing, pure-n-simple
Lecturer in Comp. Sci., University of San Francisco

#8472 From: mzukowski@...
Date: Wed Jun 4, 2003 5:40 pm
Subject: RE: Why does it silently ignore invalid input?
montyzukowski
Send Email Send Email
 
Try turning off the default error handler with the option
{defaultErrorHandler=false;}

Monty

-----Original Message-----
From: Paul J. Lucas [mailto:dude@...]
Sent: Wednesday, June 04, 2003 9:32 AM
To: antlr-interest@yahoogroups.com
Subject: [antlr-interest] Why does it silently ignore invalid input?


I have a grammar with a second entry-point that I call.  In my grammar,
"DECLARE" is
a keyword (must be upper-case).  When the generated parser encounters
"declare"
(lower-case), it simply breaks out of the parse loop and returns.  Why
doesn't it throw
an exception?




Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

#8473 From: Brian Smith <brian-l-smith@...>
Date: Wed Jun 4, 2003 5:54 pm
Subject: Re: Why does it silently ignore invalid input?
antlrbrian
Send Email Send Email
 
If you want ANTLR to try to match everything up through the end of the
input, you need to make sure that your start rule(s) end with EOF:

If you have a start rule like:

       a: b c d ;

you probably want:

       a: b c d EOF ;

I don't know if this is your exact problem but it seems like it matches
the symptoms you are describing.

- Brian

mzukowski@... wrote:
> Try turning off the default error handler with the option
> {defaultErrorHandler=false;}
>
>> From: Paul J. Lucas [mailto:dude@...]
>> Subject: [antlr-interest] Why does it silently ignore invalid input?
>
>> I have a grammar with a second entry-point that I call.  In my grammar,
>> "DECLARE" is a keyword (must be upper-case).  When the generated
  >> parser encounters "declare" (lower-case), it simply breaks
  >> out of the parse loop and returns.  Why doesn't it throw an
  >> exception?

#8474 From: Dave Makalsky <dm@...>
Date: Wed Jun 4, 2003 6:10 pm
Subject: Weak parsers
dmakalsky
Send Email Send Email
 
Hi:

Are there any examples of 'error rules' so that I can parse a slightly
wrong source file?

Thanks,

Dave Makalsky

#8475 From: "Paul J. Lucas" <dude@...>
Date: Wed Jun 4, 2003 6:53 pm
Subject: Re: Why does it silently ignore invalid input?
ypjl
Send Email Send Email
 
--- In antlr-interest@yahoogroups.com, Brian Smith <brian-l-smith@u...> wrote:
> If you want ANTLR to try to match everything up through the end of the
> input, you need to make sure that your start rule(s) end with EOF:

Yep, that was it.  Thanks!  :-)

#8476 From: Ruslan Zasukhin <sunshine@...>
Date: Wed Jun 4, 2003 8:23 pm
Subject: how to allow keywords as variables
sunshine@...
Send Email Send Email
 
Hi Terrence,

I have look on your lecture page and found here few PDF and MP3 audio.

I am very interested now in question "how to allow keywords as variables "
But there is only MP3 for this issue.

Problem is that I am not native English man, so I afraid it will be hard for
me understand it listening MP3.

Why there is no PDF files for many lectures in "Worksheet 0" for example?

I wonder where I can find answer on this question in your standard docs at
     http://antlr.org/doc/index.html  ?

--
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan@...
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------

#8477 From: "Jim Irwin" <jimirwin@...>
Date: Wed Jun 4, 2003 11:57 pm
Subject: Lexing problem
hololad
Send Email Send Email
 
Hi, I'm new to Antlr, and I have a problem for which I would welcome
suggestions.  I'm trying to parse ColdFusion code, and the language
allows strings to contain expressions.  The syntax is roughly the
following: varname = "... #expression_1# ..." where the hash marks
enclose a ColdFusion expression that is evaluated and substituted
into the string at runtime.

The real problem is that the embedded expression is itself allowed
to contain strings, so that a single source-code string may look
like the following:

"...#iif("a" gt "#b#", "cat", "dog")#..."

My problem is that I cannot think of a way to define a lexical rule
that would recognize such a complex string.  In principle, the
string should be parsed.  I can conceive of the lexer returning a
token representing the entire string to the parser, and the parser
then recursively lexing and parsing the string value until there are
no more embedded hash-expressions.

I have no clue as to how I should proceed.  In order to lex the
string, I seem to need a specialized routine that looks ahead, keeps
track of nested expressions and their strings, and terminates only
when the matching end quote outside of all expressions is
encountered.

Any suggestions?

#8478 From: "rideyour_face2" <rideyour_face2@...>
Date: Thu Jun 5, 2003 5:19 am
Subject: Am I a MILF?
rideyour_face2
Send Email Send Email
 
Do you think that I am a MILF?
I heard a couple of my sons friends talking the other night and they said that I
was.
I never really thought about it before bit I think I might be. I am divorced now
and it would be nice to have some young stud to use and abuse..lol.
If you want to come check out my pics I have them here
http://www.altsexfinder.com/landing.asp?afl=FYHO
If you ever want to chat sometime Yahoo IM me at honey_nips2003

#8479 From: Ric Klaren <klaren@...>
Date: Thu Jun 5, 2003 2:08 pm
Subject: ANNOUNCE: new development snapshot
izniegoed
Send Email Send Email
 
Hi,

Finally I got some time to resync on my mailbox and do some antlr stuff.

The result of this can be found at this link:

http://wwwhome.cs.utwente.nl/~klaren/antlr/antlr-20030605.tar.gz

This snapshot is cut from the current maintrunk.

- Fixes to configure/Makefile build I hope it now works out of the box. And
   behaves the same as Terence's build scripts (e.g. only one antlr.jar)
- I included/merged a number of MSVC fixes (mainly the ones from Alexander
   Lenski kudos to him for supplying this stuff, also thanks to Thomas
   Dudziak and other supplying patches)
   - Fixed ANTLR_API stuff in config.h
   - Put ANTLR_API on generated classes and structs.
   - I hope it now builds ok on MSVC 7.0
   - I expect better behaviour on MSVC 6.0 but no guarantees. Might still need
     Thomas' STLPort solution.

Please follow MSVC instructions in lib/cpp/README. In short for a non dll
build add all the lib/cpp/src/*.cpp (except dll.cpp) files and put lib/cpp
in the include path of the compiler. (Do *not* use the stuff from the
contrib dir its outdated)

I did not yet compile a list of bugfixes since 2.7.2 release. But I'm
pretty sure all trivial fixes are in.

I'd appreciate all the feedback form MSVC users. (Keep in mind that I don't
have access to these compilers and cannot test this stuff)

I do not exactly know how long I will have time but I hope we can get a
fixup release out. I might try making the stuff Cygwin or Mingw friendly.

As with all development snapshots YMMV, it may blow up in your face, no
guarantees.

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
     ---- Ric Klaren ----- j.klaren@... ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
   "I don't have anything against Java - it's the best damn implementation
               of UCSD Pascal ever released..." --- Larry Smith

#8480 From: Thomas Jackson III <thomas.jackson@...>
Date: Thu Jun 5, 2003 3:07 pm
Subject: Eclipse Plugin - Problem
trjIII
Send Email Send Email
 
Hi all,

I am using the Eclipse plugin(version 1.0.3) for Antlr development and have
run across an anomaly that someone hopefully has an answer to.

I have the following tokens declared in the Lexer

NOT : '¬';
NG  : "¬>";
NL  : "¬<";
NE  : "¬=";

When I compile the grammar in Eclipse it returns the following errors.

Token stream error reading grammar(s): jcl.g
unexpected char: '''

Now, if I go to a command prompt and run the exact same Grammar using
antlr.jar(version 2.7.2) from the Antlr download, I get no errors.

It has to do with the ¬ character, but why would it generate code in one and
fail in the other?

Any suggestions as to what may be causing this?

Thanks
Thomas Jackson

Messages 8451 - 8480 of 14630   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help