Re: Compiler with adjustable parsers

pgl@cup.portal.com
Fri, 2-Mar-90 19:46:34 PST

          From comp.compilers

Related articles
Compiler with adjustable parsers hackeron@ATHENA.MIT.EDU (1990-03-01)
Re: Compiler with adjustable parsers grunwald@foobar.Colorado.EDU (Dirk Grunwald) (1990-03-01)
Re: Compiler with adjustable parsers arnold@audiofax.com (Arnold Robbins) (1990-03-01)
Re: Compiler with adjustable parsers steve@hubcap.clemson.edu (1990-03-01)
Re: Compiler with adjustable parsers dhw@itivax.iti.org (1990-03-02)
Re: Compiler with adjustable parsers pgl@cup.portal.com (1990-03-15)
Re: Compiler with adjustable parsers ipser@vaxa.isi.edu (Ed Ipser) (1990-03-03)
Re: Compiler with adjustable parsers PIRINEN@CC.HELSINKI.FI (Pekka P. Pirinen) (1990-03-03)
Re: Compiler with adjustable parsers fineman@ptolemy.arc.nasa.gov (Charles Fineman) (1990-03-05)
Re: Compiler with adjustable parsers webber@athos.rutgers.edu (1990-03-07)
Re: Compiler with adjustable parsers aarons@cogs.sussex.ac.uk (Aaron Sloman) (1990-03-08)
| List of all articles for this month |
From: pgl@cup.portal.com
Date: Fri, 2-Mar-90 19:46:34 PST
Keywords: prolog

> Does anyone know of a compiler/language that allows you to specify changes
> to how the language is parsed (in part at least) from withing the program.


Sure: Prolog allows (re)defining operators. In addition, IBM-Prolog
allows specifying various other syntax items, by changing its scan
tables and its table of "assignable atoms". For example, it allows
the Edinburgh syntax:
a([X|_y],_) :- b(X), !, c(X,_y) .
and, by simply changing these tables and defining different operators,
the default IBM syntax, modified for keyboards without square brackets:
a({X!*y},*) <- b(X) & / & c(X,*y) .


What's more, you can input a clause in one syntax, change the syntax and
then get the clause back in the new syntax (using clause/2 or ax(*,*)).


The parser is quite fast because during processing, all atoms must
be hashed anyway, so comparing against an "assignable atom" is just
a pointer comparison.


- peter ludemann pgl@cup.portal.com [standard disclaimer]





Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.