From: Stuart Watt
Subject: Re: Generating parsers in Lisp
Date: 
Message-ID: <S.N.K.Watt-2305951112470001@uu-stuart-mac.open.ac.uk>
> In article <······················@oxvaxd>, ····@vax.oxford.ac.uk 
> (Jocelyn Paine) writes:
> 
> |> What tools would readers recommend for defining the grammar of a
> |> programming language in Lisp and generating a parser for it?

I have an integrated lex and yacc equivalent set of tools written in
Common Lisp. I have used these to generate complete parsers for a variety
of different languages. They are not as elegant or as efficient as either
lex or yacc (or, better, flex or bison) but they get the job done, and
they aren't hard to use. 

People can mail me directly if you want the sources, at ··········@open.ac.uk. 

An example lexical analyser rule:

(defaction (mike "[0-9]+" :kind lexical :context context)
  (list 'integer (parse-integer (get-token-string stream))))

And example parser generator rules:

(defaction (mike (top.level.forms --> top.level.forms top.level.form)
                 :kind syntax :context context))

(defaction (mike (top.level.forms --> )
                 :kind syntax :context context))

Regards, Stuart

-- 
Stuart Watt; Human Cognition Research Laboratory, Open University,
Walton Hall, Milton Keynes, MK7 6AA, UK. 
Tel: +44 1908 654513; Fax: +44 1908 653169. 
WWW: http://kmi.open.ac.uk/~stuart/stuart.html