|Dynamic Operators in Prolog firstname.lastname@example.org (1989-04-20)|
|Re: Dynamic Operators in Prolog harvard!ogccse.ogc.edu!pase (1989-04-26)|
|Re: Dynamic Operators in Prolog nigelh@uvicctr.UVic.ca.UUCP (1989-04-26)|
|From:||nigelh@uvicctr.UVic.ca.UUCP (R. Nigel Horspool)|
|Date:||26 Apr 89 15:30:49 GMT|
|Organization:||University of Victoria, Victoria B.C. Canada|
I have managed to implement a parser for Prolog and its
dynamically-defined operators using lex & yacc, but it is
extremely messy. Since all the shift-reduce conflicts are
resolved at parser-creation time, there are only two possible
1. Construct a grammar where all possible precedence levels for the
operators are pre-defined. (But typical Prologs allow 255 or more
2. Have semantic actions attached to production rules that
look up the operator precedences and associativities.
The semantic actions then select a shift action or a reduce
action by telling the lexer to insert extra symbols into the input.
The extra symbols subsequently cause the parse to follow either a
shift path or a reduce path.
I implemented #2, but this simple idea has a lot of complications.
I will happily e-mail a short paper giving the full details to
anyone who requests it.
R. Nigel Horspool
Return to the
Search the comp.compilers archives again.