[comp.lang.modula2] Is there a lex and yacc?

klarich@a.cs.okstate.edu (Terry Klarich) (08/25/88)

Does anyone have or know where I might obtain a lex and yacc that
outputs Modula2.  I am taking a compiler writing class and would
rather not use C to do my project.  If there is a big response, I 
will be happy to summarize.  Many thanks.
 
-- 
Terry Klarich (klarich@a.cs.okstate.edu) n5hts
Remember: back up your disk so it won't crash
These opinions are mine

wyle@solaris.UUCP (Mitchell Wyle) (08/29/88)

There's a system called rec by Josef Grosch at
GMD Forschungsstelle in Karlsruhe (Germany)
which generates m2 code.  I sent him a tape
and he sent me rex.  Contact him at:

gag@gmdka.uucp

If Mr. Grosch wants me to, I'll release it to
usenet.  -Mitch

-- 
-Mitchell F. Wyle            wyle@ethz.uucp
Institut fuer Informatik     wyle%ifi.ethz.ch@relay.cs.net
ETH Zentrum                  
8092 Zuerich, Switzerland    +41 1 256-5237

grosch@gmdka.UUCP (Josef Grosch) (09/01/88)

In article <3852@okstate.UUCP> klarich@okstate.UUCP (Terry Klarich) writes:
>Does anyone have or know where I might obtain a lex and yacc that
>outputs Modula2.


Rex, Lalr and Ell - Compiler Construction Tools
===============================================

     Rex (Regular EXpression tool) is a scanner  generator  whose
specifications  are  based  on  regular expressions and arbitrary
semantic actions written in one of  the  target  languages  C  or
Modula-2.  As  scanners sometimes have to consider the context to
unambiguously recognize a token the right context can  be  speci-
fied by an additional regular expression and the left context can
be handled by so-called  start  states.  The  generated  scanners
automatically  compute the line and column position of the tokens
and offer an efficient mechanism  to  normalize  identifiers  and
keywords  to upper or lower case letters. The scanners are table-
driven and run at a speed of 180,000 to 195,000 lines per  minute
on a MC 68020 processor.

     Lalr is a LALR(1) parser generator accepting grammars  writ-
ten  in  extended BNF notation which may be augmented by semantic
actions expressed by statements of the target language. The  gen-
erator  provides  a  mechanism  for  S-attribution,  that is syn-
thesized attributes can be computed during parsing.  In  case  of
LR-conflicts  unlike  other tools Lalr provides not only informa-
tion about an internal state consisting of a set of items but  it
prints a derivation tree which is much more useful to analyze the
problem. Conflicts can be resolved by specifying  precedence  and
associativity of operators and productions. The generated parsers
include automatic  error  recovery,  error  messages,  and  error
repair.  The  parsers  are  table-driven  and  run  at a speed of
400,000 lines per minute. Currently parsers can be  generated  in
the target languages C and Modula-2.

     Ell is a LL(1) parser generator accepting the same  specifi-
cation  language  as  Lalr except that the grammars must obey the
LL(1) property. The generated  parsers  include  automatic  error
recovery,  error  messages,  and  error  repair  like  Lalr.  The
parsers are implemented following the  recursive  descent  method
and  reach a speed of 900,000 lines per minute. The possible tar-
get languages are again C and Modula-2.

     All the tools are implemented in Modula-2.
A comparison of the above tools with the corresponding UNIX
tools shows that significant improvements have been achieved:
Rex generated scanners are 4 times faster than those of LEX.
Lalr generated parsers are 3 times faster than those of YACC.

The tools are public domain. They have been developed in 1987.
They have been tested by generating scanners and parsers for
e. g. Pascal, Modula, Oberon, C, Ada and found stable. There
are user manuals and a paper on how Rex works will be published soon.
Everybody interested in the tools can obtain the sources free of charge. The
sources are organized as a UNIX file tree.

The tools have been developed using our own Modula-2 compiler called MOCKA on
a MC 68020 based UNIX workstation. It has been ported to the SUN workstation
and been compiled successfully using the SUN Modula-2 compiler. This should
assure a reasonable level of portability.

I can not send the tools by E-mail. This would be too expensive because of
the size of the sources.
Currently the easiest way of distribution is to send a streamer tape for SUN
workstations which I return with the source code (unix file tree in tar
format). I'm planning to post the sources to some appropriate news
group in the near future.


     Josef Grosch
     GMD - Forschungsstelle an der Universitaet Karlsruhe
     Haid-und-Neu-Str. 7
     D-7500 Karlsruhe 1
     West Germany

     Phone 0721-662226
     grosch@gmdka.UUCP

MFELDMAN@GWUVM.BITNET (Michael Feldman) (09/02/88)

I recently sent a streamer tape to Schroeer for a copy of MOCKA. If the
tape has not yet been sent back to me, can you include the tools mentioned
in this posting? Thank you very much.


------------------------------------------------------------------------
Michael B. Feldman, Professor              residence address for USNail:
Dept. of Elect. Engrg. and Comp. Sci       Michael B. Feldman
The George Washington University           6218 Wagner Lane
Washington, DC  20052  U.S.A.              Bethesda, MD  20816  U.S.A.
202-994-5253
MFELDMAN@GWUVM.BITNET