diff options
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/interp/Makefile.in | 5 | ||||
-rw-r--r-- | src/interp/spad-parser.boot | 36 |
3 files changed, 43 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c7ab6055..9a17233e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2012-06-10 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/newaux.lisp (MAKEOP): Move to spad-parser.boot. + Remove file. + * interp/Makefile.in: Adjust. + +2012-06-10 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/newaux.lisp: Move Led property setting to spad-parser.boot. 2012-06-10 Gabriel Dos Reis <gdr@cs.tamu.edu> diff --git a/src/interp/Makefile.in b/src/interp/Makefile.in index db05e53b..b35b6597 100644 --- a/src/interp/Makefile.in +++ b/src/interp/Makefile.in @@ -90,7 +90,7 @@ OBJS= boot-pkg.$(FASLEXT) types.$(FASLEXT) \ lisplib.$(FASLEXT) macex.$(FASLEXT) \ match.$(FASLEXT) monitor.$(FASLEXT) \ msg.$(FASLEXT) msgdb.$(FASLEXT) \ - newaux.$(FASLEXT) newfort.$(FASLEXT) \ + newfort.$(FASLEXT) \ nrunfast.$(FASLEXT) osyscmd.$(FASLEXT) \ packtran.$(FASLEXT) pf2sex.$(FASLEXT) \ scan.$(FASLEXT) pile.$(FASLEXT) \ @@ -314,11 +314,10 @@ server.$(FASLEXT): sys-macros.$(FASLEXT) ## The old parser component roughtly is: ## -spad-parser.$(FASLEXT): parse.$(FASLEXT) lexing.$(FASLEXT) newaux.$(FASLEXT) +spad-parser.$(FASLEXT): parse.$(FASLEXT) lexing.$(FASLEXT) parse.$(FASLEXT): postpar.$(FASLEXT) packtran.$(FASLEXT): sys-macros.$(FASLEXT) postpar.$(FASLEXT): sys-macros.$(FASLEXT) -newaux.$(FASLEXT): sys-macros.$(FASLEXT) sys-utility.$(FASLEXT) nlib.$(FASLEXT): sys-macros.$(FASLEXT) lexing.$(FASLEXT): sys-utility.$(FASLEXT) sys-macros.$(FASLEXT) \ io.$(FASLEXT) diff --git a/src/interp/spad-parser.boot b/src/interp/spad-parser.boot index 678c66d2..71f2d60a 100644 --- a/src/interp/spad-parser.boot +++ b/src/interp/spad-parser.boot @@ -42,7 +42,6 @@ -- -- gdr/2007-11-02 -- -import newaux import lexing import parse namespace BOOT @@ -1131,6 +1130,41 @@ for x in ["-", "=", "*", "rem", "mod", "quo", "div", "/", "^", --% +--% +--% Led and Nud have to do with operators. An operator with a Led property +--% takes an operand on its left (infix/suffix operator). +--% +--% An operator with a Nud takes no operand on its left (prefix/nilfix). +--% Some have both (e.g. - ). This terminology is from the Pratt parser. +--% The translator for Scratchpad II is a modification of the Pratt parser +--% which branches to special handlers when it is most convenient and +--% practical to do so (Pratt's scheme cannot handle local contexts very +--% easily). +--% +--% Both LEDs and NUDs have right and left binding powers. This is meaningful +--% for prefix and infix operators. These powers are stored as the values of +--% the LED and NUD properties of an atom, if the atom has such a property. +--% The format is: +--% <Operator Left-Binding-Power Right-Binding-Power <Special-Handler>> +--% where the Special-Handler is the name of a function to be evaluated when +--% that keyword is encountered. +--% +--% The default values of Left and Right Binding-Power are NIL. NIL is a +--% legitimate value signifying no precedence. If the Special-Handler is NIL, +--% this is just an ordinary operator (as opposed to a surfix operator like +--% if-then-else). +--% + +PARSE_-NewKEY := nil + +MAKEOP(x,y,keyname) == + if rest x = nil or integer? second x then + x := [first x,:x] + if alphabetic? stringChar(symbolName first x,0) and + not symbolMember?(first x,symbolValue keyname) then + symbolValue(keyname) := [first x,:symbolValue keyname] + property(first x,y) := x + MAKENEWOP(x,y) == MAKEOP(x,y,'PARSE_-NewKEY) |