[antlr-interest] Testing ANTLR grammar as a whole.

Bharath S bharath at starthis.com
Wed May 5 08:45:05 PDT 2004



Hi Monty,

I am writing a compiler for a language that does not have single entry point
as such. It just contains statements which get used within function bodies
or program bodies. 

As an example, in a java application, you need to have a class definition
and a main function in atleast one of your java files. There is no such
requirement in this language and it can be treated as a language used to
write macros or small blocks of code.

Thanks much,

Bharath.
 

-----Original Message-----
From: Monty Zukowski [mailto:monty at codetransform.com] 
Sent: Wednesday, May 05, 2004 10:28 AM
To: antlr-interest at yahoogroups.com
Cc: Monty Zukowski
Subject: Re: [antlr-interest] Testing ANTLR grammar as a whole.

On May 5, 2004, at 8:18 AM, Bharath S wrote:

> If I wanted to test the antlr grammar as a whole instead of testing
> individual rules, should I rewrite my rules such that the first rule 
> that I
> call is the combination of all other rules? For example, if I have a 
> pascal
> grammar and I feed the input as a test.pas file, I want the parser to 
> test
> the entire *.pas file for syntax instead of providing command line 
> input to
> test each rule individually.
>
That's what I do.

> I saw the pascal grammar at antlr.org and it has one single rule called
> "program heading" which seems to be highest rule in the hierarchy. To 
> follow
> the same approach, I have to rewrite my rules. Is there any other 
> option by
> which I can test my entire program instead of just individual rules, 
> without
> rewriting the existing grammar?

Most parsers I've worked with have one entry point for an entire 
program.  What kind of a grammar are you writing that has lots of 
different entry points?  What drives your parser?  Is it what decides 
which rule to call?  If so, figure out a way to script it so it does 
all the different rule calling.

Monty Zukowski

ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit -- 
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html



 
Yahoo! Groups Links



 





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list