aboutsummaryrefslogtreecommitdiff
path: root/src/interp/pf2sex.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-12-08 07:35:22 +0000
committerdos-reis <gdr@axiomatics.org>2008-12-08 07:35:22 +0000
commit52b3f7dee38b7a15e1b017e6a41ac63cbf6e95e8 (patch)
tree9f6023cdfd57bf982486d866ba32252d304b659e /src/interp/pf2sex.boot
parentdec92cd40550e8532d36502dd75d6f9d639d7f7c (diff)
downloadopen-axiom-52b3f7dee38b7a15e1b017e6a41ac63cbf6e95e8.tar.gz
2008-12-07 Gabriel Dos Reis <gdr@cs.tamu.edu>
* interp/g-opt.boot ($simpleVMoperators): New. (isSimpleVMForm): Likewise. (isFloatableVMForm): Likewise. (optLET): Likewise. Expand backend let-forms. * interp/c-util.boot (foldSpadcall): Look into LET and COND forms. (replaceSimpleFunctions): Likewise. (mutateCONDFormWithUnaryFunction): New. (mutateLETFormWithUnaryFunction): Likewise. * interp/compiler.boot (tryCourtesyCoercion): Split from coerce. (compRetractAlternative): Simplify. Now try courtesy coercions before retraction. (compRecoverAlternative): New. (compMatch): Simplify. Implement type recovery too. 2008-12-06 Gabriel Dos Reis <gdr@cs.tamu.edu> * interp/compiler.boot (compRetractAlternative): New. (compMatch): Likewise. Use it to implement pattern macthing for retractable domains. * interp/parse.boot (parseAtAt): New. * interp/postpar.boot (postAtAt): Likewise. (postAlternatives): Likewise. (postMatch): Likewise. * interp/metalex.lisp (Keywords): Remove `otherwise' as keyword. * interp/fnewmeta.lisp (|PARSE-Match|): New local parser. * interp/newaux.lisp (@@): New token. Align wih interpreter. (otherwise): Remove binding specification. (case): Now also a Nud token.
Diffstat (limited to 'src/interp/pf2sex.boot')
-rw-r--r--src/interp/pf2sex.boot9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/interp/pf2sex.boot b/src/interp/pf2sex.boot
index 9da4d3b4..56539978 100644
--- a/src/interp/pf2sex.boot
+++ b/src/interp/pf2sex.boot
@@ -175,6 +175,7 @@ pf2Sex1 pf ==
case pf of
%Exist(vars,expr) => pfQuantified2Sex("%Exist",vars,expr)
%Forall(vars,expr) => pfQuantified2Sex("%Forall",vars,expr)
+ %Match(expr,alts) => pfCase2Sex(expr,pfParts alts)
otherwise => keyedSystemError('"S2GE0017", ['"pf2Sex1"])
pfLiteral2Sex pf ==
@@ -534,3 +535,11 @@ pfInline2Sex pf ==
pfQualType2Sex pf ==
-- pfQualTypeQual is always nothing.
pf2Sex1 pfQualTypeType pf
+
+++ convert interpreter parse forms to traditional s-expressions
+pfCase2Sex(expr,alts) ==
+ ["%Match",pf2Sex1 expr, [alt2Sex alt for alt in alts]] where
+ alt2Sex alt ==
+ not pfExit? alt =>
+ systemError '"alternatives must be exit expressions"
+ [pf2Sex1 pfExitCond alt, pf2Sex1 pfExitExpr alt]