diff options
author | dos-reis <gdr@axiomatics.org> | 2011-10-19 20:57:45 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-10-19 20:57:45 +0000 |
commit | 2227d0b0e896b63b8f27ff3ba8b9fc74495a8acb (patch) | |
tree | af68a239565e80812c1e32c6999c4d657b6b46e4 /src/interp/postpar.boot | |
parent | 7b303a090ac77ca67771feb829a15ab3bab06122 (diff) | |
download | open-axiom-2227d0b0e896b63b8f27ff3ba8b9fc74495a8acb.tar.gz |
* interp/postpar.boot (postNormalizeName): New.
(postAtom): Use it.
(postMDef): Do not generate artificial list of nils.
Leave left-hand-side as written in source code.
* interp/compiler.boot (compMacro): Tidy.
* interp/define.boot (checkRepresentation): Likewise.
* interp/parse.boot (parseMDEF): Likewise.
* algebra/syntax.spad.pamphlet (MacroAst): Adjust.
Diffstat (limited to 'src/interp/postpar.boot')
-rw-r--r-- | src/interp/postpar.boot | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/interp/postpar.boot b/src/interp/postpar.boot index e4148a8f..59b13294 100644 --- a/src/interp/postpar.boot +++ b/src/interp/postpar.boot @@ -162,14 +162,20 @@ postMakeCons l == postTran a ["cons",postTran first l,postMakeCons rest l] +postNormalizeName: %Symbol -> %Symbol +postNormalizeName x == + x = "T" => "T$" -- rename T in spad code to avoid clash with Lisp + x = "^" => "**" -- always use `**' internally for exponentiation + x + postAtom: %Atom -> %ParseForm postAtom x == - x=0 => $Zero - x=1 => $One - x='T => "T$" -- rename T in spad code to T$ - ident? x and niladicConstructor? x => [x] - x="," => "%Comma" - x = "^" => "**" -- always use `**' internally for exponentiation + x is 0 => $Zero + x is 1 => $One + x is "," => "%Comma" + ident? x => + niladicConstructor? x => [x] + postNormalizeName x x postBlock: %ParseTree -> %ParseForm @@ -245,21 +251,26 @@ postDefArgs argl == postMDef: %ParseTree -> %ParseForm postMDef(t) == [.,lhs,rhs] := t - lhs := postTran lhs + lhs := + ident? lhs => postNormalizeName lhs + lhs is [.,:.] => [postNormalizeName x for x in lhs] + lhs [form,targetType]:= - lhs is [":",:.] => rest lhs + lhs is [":",:.] => lhs.args [lhs,nil] - form:= - form isnt [.,:.] => [form] + newLhs := + form is [.,:.] => [(x is [":",a,:.] => a; x) for x in form] form - newLhs:= [(x is [":",a,:.] => a; x) for x in form] - typeList:= [targetType,:[(x is [":",.,t] => t; nil) for x in rest form]] - ["MDEF",newLhs,typeList,[nil for x in form],postTran rhs] + typeList := + form is [.,:.] => + [targetType,:[(x is [":",.,t] => t; nil) for x in rest form]] + nil + ["MDEF",newLhs,typeList,postTran rhs] postElt: %ParseTree -> %ParseForm postElt u == u isnt [.,a,b] => systemErrorHere ["postElt",u] - a:= postTran a + a := postTran a b is ["%Sequence",:.] => [["elt",a,"makeRecord"],:postTranList rest b] ["elt",a,postTran b] |