Hello everyone,

      Don't mean to be a pest, but I am waiting for a response to my
inquiry below.  In the meantime, I have found an "off the shelf" perl
program to do the job, yagg (see introductory documentation):

yagg - generates a string generator from a grammar

Given YACC-like and LEX-like input files, yagg generates a C++ program that

generates all strings of a user-specified length. The YACC-like language

grammar file provides the grammar productions for string generation, along

with optional action blocks that can perform context-sensitive checks in
order

to limit the generated strings. The LEX-like terminal generator file
provides

specifications that instruct the program how to generate strings for
terminals

in the grammar.

If the programmer already has a YACC or Bison parser file, he or she only

needs to add "unaction" blocks to allow the recursive generator to undo the

side effects of the action blocks. If the programmer already has a LEX or
FLEX

lexer input file, he or she only needs to remove extraneous code and replace

any regular expressions with one of the terminal generator specifications.

What's it good for? Automated testing, for one thing. Alan Karben at XML
Team

is using yagg along with sports data to compute the likelihood of all
possible

outcomes for certain play situations in baseball.
--------------------------------------------------------------------------------------------------------------------

It would be nice if I could run the output of YAGG past the Mozart compiler
with certain errors and warnings suppressed in order to test whether there
are errors in my YAGG grammar.  For example, LOCAL Y IN X = 5 END would
generate an error since Y is introduced, not X.  However, it does meet the
the Oz syntax of LOCAL VARIABLE IN ASSIGNMENT END.

I would then use the YAGG output to test a parser written in LPG, the parser
generator used by SAFARI, which is a new framework to be released this
summer to facilitate writing Eclipse editors (in this case, one for the Oz
language).

Please let me know how and which errors and warnings to suppress from a
list.  I am asking for this because I am not yet proficient with all the
"ins and outs" of the Mozart language.

                                                            Thanks,
                                                            Craig

P.S.  YAGG will not produce a listing of all the possible valid Oz programs
of a certain length, just a subset.  I think that task would possibly entail
constraints and/or understanding the semantics (terminology?) of the Mozart
compiler.  It depends how much of a perfectionist we want to be.  I am just
concerned that having written the editor, that there will be errors in the
parser that will still need to be rectified.  By way of reference, how did
you go about testing that the Mozart parser itself was valid when you wrote
it?

On 3/26/07, Craig Ugoretz <[EMAIL PROTECTED]> wrote:

Hello,

     I have been trying to figure out a way to test a parser for the Oz
language in Eclipse in order to implement an editor.  At this point, I care
to ask (having reviewed the ErrorListener documentation in Appendix B of the
compiler section) if there is a way to get a number or identifier for an
error or warning instead?  Also, can I have a list of all Mozart errors and
warnings and some guidance about which are relevant to testing a parser (
i.e. compile time as opposed to run time, for example)?

     As for my earlier posting about a constraint based search for a
production grammar that would generate input that could be compiled
successfully by Mozart, I realize that was quite grand.  At this point, I
think that I will have to settle for a production grammar generator that
creates a far reaching, but not totally exhaustive set of combinations of
program input.  Remember, a production grammar is the set of all sentences
(terminology?) that satisfy a grammar.  The main problem I see generating a
production grammar for the Oz language, and any language in general, is
"combinatorial explosion".  It is currently beyond my capabilities to deal
with this issue in a less than naive manner ( i.e. a subset of all the
combinations of terminals and nonterminal "paths" in the grammar).  I have
looked as thoroughly as possible on the Internet for production grammar
generators that are free to use or publicly available, and I have not found
any.


Sincerely,

                                                                                
   Craig

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to