Path: utzoo!censor!geac!torsqnt!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!wuarchive!decwrl!crltrx!decvax!ima!esegue!compilers-sender From: pgl@cup.portal.com Newsgroups: comp.compilers Subject: Re: Compiler with adjustable parsers Keywords: prolog Message-ID: <1990Mar3.062743.26438@esegue.segue.boston.ma.us> Date: 3 Mar 90 06:27:43 GMT Sender: compilers-sender@esegue.segue.boston.ma.us Reply-To: pgl@cup.portal.com Organization: Compilers Central Lines: 20 Approved: compilers@esegue.segue.boston.ma.us > 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] -- Send compilers articles to compilers@esegue.segue.boston.ma.us {spdcc | ima | lotus}!esegue. Meta-mail to compilers-request@esegue. Please send responses to the author of the message, not the poster.