diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index 0bb103d..00218bc 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -5449,6 +5449,14 @@ and the current token (\$ttok) \chapter{Pftrees} \section{Special Nodes} +\defun{pfListOf}{Create a Listof node} +\calls{pfListOf}{pfTree} +<>= +(defun |pfListOf| (x) + (|pfTree| '|listOf| x)) + +@ + \defun{pfNothing?}{Is this a Nothing node?} \calls{pfNothing?}{pfAbSynOp?} <>= @@ -5459,6 +5467,22 @@ and the current token (\$ttok) \section{Leaves} +\defun{pfDocument}{Create a Document node} +\calls{pfDocument}{pfLeaf} +<>= +(defun |pfDocument| (strings) + (|pfLeaf| '|Document| strings)) + +@ + +\defun{pfId?}{Is this an Id node?} +\calls{pfId?}{pfAbSynOp?} +<>= +(defun |pfId?| (form) + (or (|pfAbSynOp?| form '|id|) (|pfAbSynOp?| form '|idsy|))) + +@ + \defun{pfIdSymbol}{Return the Id part} \calls{pfIdSymbol}{tokPart} <>= @@ -5467,6 +5491,14 @@ and the current token (\$ttok) @ +\defun{pfLeafToken}{Return the Leaf Token} +\calls{pfLeafToken}{tokPart} +<>= +(defun |pfLeafToken| (form) + (|tokPart| form)) + +@ + \defun{pfLiteral?}{Is this a Literal node?} \calls{pfLiteral?}{pfAbSynOp} <>= @@ -5476,6 +5508,29 @@ and the current token (\$ttok) @ +\defun{pfLiteralClass}{Create a LiteralClass node} +\calls{pfLiteralClass}{pfAbSynOp} +<>= +(defun |pfLiteralClass| (form) + (|pfAbSynOp| form)) + +@ + +\defun{pfLiteralString}{Return the LiteralString} +\calls{pfLiteralString}{tokPart} +<>= +(defun |pfLiteralString| (form) + (|tokPart| form)) + +@ + +\defun{pfParts}{Return the parts of a tree node} +<>= +(defun |pfParts| (form) + (cdr form)) + +@ + \defun{pfSymbol?}{Is this a Symbol node?} \calls{pfSymbol?}{pfAbSynOp?} <>= @@ -5494,6 +5549,13 @@ and the current token (\$ttok) \section{Trees} +\defun{pfTree}{Construct a tree node} +<>= +(defun |pfTree| (x y) + (cons x y)))) + +@ + \defun{pfAnd?}{Is this an And node?} \calls{pfAnd?}{pfAbSynOp?} <>= @@ -5555,6 +5617,21 @@ and the current token (\$ttok) @ +\defun{pfBreak?}{Is this a Break node?} +\calls{pfBreak?}{pfAbSynOp?} +<>= +(defun |pfBreak?| (pf) + (|pfAbSynOp?| pf '|Break|)) + +@ + +\defun{pfBreakFrom}{Return the From part of a Break node} +<>= +(defun |pfBreakFrom| (|pf|) + (cadr |pf|)) + +@ + \defun{pfCoerceto?}{Is this a CoerceTo node?} \calls{pfCoerceto?}{pfAbSynOp?} <>= @@ -5736,6 +5813,14 @@ and the current token (\$ttok) @ +\defun{pfIterate?}{Is this an Iterate node?} +\calls{pfIterate?}{pfAbSynOp?} +<>= +(defun |pfIterate?| (|pf|) + (|pfAbSynOp?| |pf| '|Iterate|)) + +@ + \defun{pfLambda?}{Is this a Lambda node?} \calls{pfLambda?}{pfAbSynOp?} <>= @@ -5785,6 +5870,14 @@ and the current token (\$ttok) @ +\defun{pfMacro?}{Is this a Macro node?} +\calls{pfMacro?}{pfAbSynOp?} +<>= +(defun |pfMacro?| (pf) + (|pfAbSynOp?| pf '|Macro|)) + +@ + \defun{pfMLambda?}{Is this an MLambda node?} \calls{pfMLambda?}{pfAbSynOp?} <>= @@ -5889,6 +5982,21 @@ and the current token (\$ttok) @ +\defun{pfReturn?}{Is this a Return node?} +\calls{pfReturn?}{pfAbSynOp?} +<>= +(defun |pfReturn?| (pf) + (|pfAbSynOp?| pf '|Return|)) + +@ + +\defun{pfReturnExpr}{Return the Expr part of a Return node} +<>= +(defun |pfReturnExpr| (pf) + (cadr pf)) + +@ + \defun{pfRule?}{Is this a Rule node?} \calls{pfRule?}{pfAbSynOp?} <>= @@ -5981,6 +6089,37 @@ and the current token (\$ttok) @ +\defun{pfWhere?}{Is this a Where node?} +\calls{pfWhere?}{pfAbSynOp?} +<>= +(defun |pfWhere?| (pf) + (|pfAbSynOp?| pf '|Where|)) + +@ + +\defun{pf0WhereContext}{Return the parts of the Context of a Where node} +\calls{pf0WhereContext}{pfParts} +\calls{pf0WhereContext}{pfWhereContext} +<>= +(defun |pf0WhereContext| (pf) + (|pfParts| (|pfWhereContext| pf))) + +@ + +\defun{pfWhereContext}{Return the Context of a Where node} +<>= +(defun |pfWhereContext| (pf) + (cadr pf)) + +@ + +\defun{pfWhereExpr}{Return the Expr part of a Where node} +<>= +(defun |pfWhereExpr| (pf) + (caddr pf)) + +@ + \defun{pfWhile?}{Is this a While node?} \calls{pfWhile?}{pfAbSynOp?} <>= @@ -9943,6 +10082,26 @@ where head is either an id or (id . alist) @ +\defun{pfAbSynOp}{Return a part of a node} +\calls{pfAbSynOp}{ifcar} +<>= +(defun |pfAbSynOp| (form) + (let (hd) + (setq hd (car form)) + (or (ifcar hd) hd))) + +@ + +\defun{pfAbSynOp?}{Compare a part of a node} +\calls{pfAbSynOp?}{eqcar} +<>= +(defun |pfAbSynOp?| (form op) + (let (hd) + (setq hd (car form)) + (or (eq hd op) (eqcar hd op)))) + +@ + \defun{pfNoPosition?}{pfNoPosition?} \calls{pfNoPosition?}{poNoPosition?} <>= @@ -10000,16 +10159,6 @@ where head is either an id or (id . alist) @ -\defun{pfAbSynOp?}{pfAbSynOp?} -\calls{pfAbSynOp?}{eqcar} -<>= -(defun |pfAbSynOp?| (form op) - (let (hd) - (setq hd (car form)) - (or (eq hd op) (eqcar hd op)))) - -@ - \chapter{Attributed Structures} For objects which are pairs where the CAR field is either just a tag (an identifier) or a pair which is the tag and an association list. @@ -34341,6 +34490,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -34350,6 +34500,8 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> +<> <> <> <> @@ -34359,6 +34511,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -34370,17 +34523,24 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> <> <> +<> <> <> +<> +<> <> +<> +<> <> <> <> +<> <> <> <> @@ -34393,12 +34553,15 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> <> <> <> +<> +<> <> <> <> @@ -34411,10 +34574,14 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> <> +<> +<> +<> <> <> <> @@ -34424,6 +34591,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> diff --git a/changelog b/changelog index 7b90eec..e1d3591 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,11 @@ +20100209 tpd src/axiom-website/patches.html 20100209.01.tpd.patch +20100209 tpd src/interp/ptrees.lisp treeshake +20100209 tpd src/interp/pf2sex.lisp treeshake +20100209 tpd books/bookvol5 treeshake ptrees, pf2sex 20100208 tpd src/axiom-website/patches.html 20100208.02.tpd.patch 20100208 tpd src/interp/ptrees.lisp treeshake 20100208 tpd src/interp/pf2sex.lisp treeshake +20100208 tpd books/bookvol5 treeshake ptrees, pf2sex 20100208 tpd src/axiom-website/patches.html 20100208.01.tpd.patch 20100208 tpd src/interp/ptrees.lisp treeshake 20100208 tpd src/interp/pf2sex.lisp treeshake diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index b721a18..93aec04 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -2445,5 +2445,7 @@ books/bookvol5 treeshake ptrees, pf2sex
books/bookvol5 treeshake ptrees, pf2sex
20100208.02.tpd.patch books/bookvol5 treeshake ptrees, pf2sex
+20100209.01.tpd.patch +books/bookvol5 treeshake ptrees, pf2sex
diff --git a/src/interp/ptrees.lisp.pamphlet b/src/interp/ptrees.lisp.pamphlet index 37764b7..e6ead92 100644 --- a/src/interp/ptrees.lisp.pamphlet +++ b/src/interp/ptrees.lisp.pamphlet @@ -12,14 +12,6 @@ <<*>>= (in-package "BOOT") -;pfAbSynOp form == -; hd := CAR form -; IFCAR hd or hd - -(DEFUN |pfAbSynOp| (|form|) - (PROG (|hd|) - (RETURN (PROGN (SETQ |hd| (CAR |form|)) (OR (IFCAR |hd|) |hd|))))) - ;pfLeaf? form == ; MEMQ(pfAbSynOp form, ; '(id idsy symbol string char float expression integer @@ -39,23 +31,11 @@ (RETURN (|tokConstruct| |x| |y| (OR (IFCAR |z|) (|pfNoPosition|)))))) -;pfLeafToken form == tokPart form - -(DEFUN |pfLeafToken| (|form|) (PROG () (RETURN (|tokPart| |form|)))) - ;pfLeafPosition form == tokPosn form (DEFUN |pfLeafPosition| (|form|) (PROG () (RETURN (|tokPosn| |form|)))) -;pfTree(x,y) == CONS(x,y) -- was ==> - -(DEFUN |pfTree| (|x| |y|) (PROG () (RETURN (CONS |x| |y|)))) - -;pfParts form == CDR form -- was ==> - -(DEFUN |pfParts| (|form|) (PROG NIL (RETURN (CDR |form|)))) - ;pfFirst form == CADR form -- was ==> (DEFUN |pfFirst| (|form|) (PROG () (RETURN (CADR |form|)))) @@ -65,10 +45,6 @@ (DEFUN |pfSecond| (|form|) (PROG () (RETURN (CADDR |form|)))) ;--% SPECIAL NODES -;pfListOf x == pfTree('listOf,x) - -(DEFUN |pfListOf| (|x|) (PROG () (RETURN (|pfTree| '|listOf| |x|)))) - ;pfListOf? x == pfAbSynOp?(x,'listOf) (DEFUN |pfListOf?| (|x|) @@ -108,14 +84,6 @@ (DEFUN |pfIdPos| (|expr| |pos|) (PROG () (RETURN (|pfLeaf| '|id| |expr| |pos|)))) -;pfId? form == -; pfAbSynOp?(form,'id) or pfAbSynOp?(form,'idsy) - -(DEFUN |pfId?| (|form|) - (PROG () - (RETURN - (OR (|pfAbSynOp?| |form| '|id|) (|pfAbSynOp?| |form| '|idsy|))))) - ;pfSymbolVariable? form == pfAbSynOp?(form,'idsy) (DEFUN |pfSymbolVariable?| (|form|) @@ -123,10 +91,6 @@ ;--pfAmpersand(amptok,name) == name ; -;pfDocument strings == pfLeaf('Document, strings) - -(DEFUN |pfDocument| (|strings|) - (PROG () (RETURN (|pfLeaf| '|Document| |strings|)))) ;pfDocument? form == pfAbSynOp?(form, 'Document) @@ -138,16 +102,6 @@ (DEFUN |pfDocumentText| (|form|) (PROG () (RETURN (|tokPart| |form|)))) -;pfLiteralClass form == pfAbSynOp form - -(DEFUN |pfLiteralClass| (|form|) - (PROG () (RETURN (|pfAbSynOp| |form|)))) - -;pfLiteralString form == tokPart form - -(DEFUN |pfLiteralString| (|form|) - (PROG () (RETURN (|tokPart| |form|)))) - ;pfStringConstString form == tokPart form (DEFUN |pfStringConstString| (|form|) @@ -183,8 +137,6 @@ (|pfSymbol| (|tokPart| |expr|) (IFCAR |optpos|))) ('T (|pfExpression| (|pfSexpr| |expr|) (IFCAR |optpos|))))))) -;pfSymbolSymbol form == tokPart form - ;--% TREES ;-- parser interface functions ;-- these are potential sources of trouble in macro expansion @@ -875,24 +827,6 @@ (DEFUN |pfWhere| (|pfcontext| |pfexpr|) (PROG () (RETURN (|pfTree| '|Where| (LIST |pfcontext| |pfexpr|))))) -;pfWhere?(pf) == pfAbSynOp? (pf, 'Where) - -(DEFUN |pfWhere?| (|pf|) - (PROG () (RETURN (|pfAbSynOp?| |pf| '|Where|)))) - -;pfWhereContext pf == CADR pf -- was ==> - -(DEFUN |pfWhereContext| (|pf|) (PROG () (RETURN (CADR |pf|)))) - -;pfWhereExpr pf == CADDR pf -- was ==> - -(DEFUN |pfWhereExpr| (|pf|) (PROG () (RETURN (CADDR |pf|)))) - -;pf0WhereContext pf == pfParts pfWhereContext pf - -(DEFUN |pf0WhereContext| (|pf|) - (PROG () (RETURN (|pfParts| (|pfWhereContext| |pf|))))) - ;-- If := (Cond: Expr, Then: Expr, Else: ? Expr) ; ;pfIf(pfcond, pfthen, pfelse) == pfTree('If, [pfcond, pfthen, pfelse]) @@ -998,11 +932,6 @@ (DEFUN |pfIterate| (|pffrom|) (PROG () (RETURN (|pfTree| '|Iterate| (LIST |pffrom|))))) -;pfIterate?(pf) == pfAbSynOp? (pf, 'Iterate) - -(DEFUN |pfIterate?| (|pf|) - (PROG () (RETURN (|pfAbSynOp?| |pf| '|Iterate|)))) - ;pfIterateFrom pf == CADR pf -- was ==> (DEFUN |pfIterateFrom| (|pf|) (PROG () (RETURN (CADR |pf|)))) @@ -1014,15 +943,6 @@ (DEFUN |pfBreak| (|pffrom|) (PROG () (RETURN (|pfTree| '|Break| (LIST |pffrom|))))) -;pfBreak?(pf) == pfAbSynOp? (pf, 'Break) - -(DEFUN |pfBreak?| (|pf|) - (PROG () (RETURN (|pfAbSynOp?| |pf| '|Break|)))) - -;pfBreakFrom pf == CADR pf -- was ==> - -(DEFUN |pfBreakFrom| (|pf|) (PROG () (RETURN (CADR |pf|)))) - ;-- Return := (Expr: ? Expr, From: ? Id) ;pfReturn(pfexpr, pffrom) == pfTree('Return, [pfexpr, pffrom]) @@ -1030,15 +950,6 @@ (DEFUN |pfReturn| (|pfexpr| |pffrom|) (PROG () (RETURN (|pfTree| '|Return| (LIST |pfexpr| |pffrom|))))) -;pfReturn?(pf) == pfAbSynOp? (pf, 'Return) - -(DEFUN |pfReturn?| (|pf|) - (PROG () (RETURN (|pfAbSynOp?| |pf| '|Return|)))) - -;pfReturnExpr pf == CADR pf -- was ==> - -(DEFUN |pfReturnExpr| (|pf|) (PROG () (RETURN (CADR |pf|)))) - ;pfReturnFrom pf == CADDR pf -- was ==> (DEFUN |pfReturnFrom| (|pf|) (PROG () (RETURN (CADDR |pf|)))) @@ -1057,11 +968,6 @@ (DEFUN |pfMacro| (|pflhs| |pfrhs|) (PROG () (RETURN (|pfTree| '|Macro| (LIST |pflhs| |pfrhs|))))) -;pfMacro?(pf) == pfAbSynOp? (pf, 'Macro) - -(DEFUN |pfMacro?| (|pf|) - (PROG () (RETURN (|pfAbSynOp?| |pf| '|Macro|)))) - ;pfMacroLhs pf == CADR pf -- was ==> (DEFUN |pfMacroLhs| (|pf|) (PROG () (RETURN (CADR |pf|))))