diff options
author | Gabriel Dos Reis <gdr@axiomatics.org> | 2015-12-24 10:22:27 -0800 |
---|---|---|
committer | Gabriel Dos Reis <gdr@axiomatics.org> | 2015-12-24 10:22:27 -0800 |
commit | bb81c833c0ff2ff8df936a0cd0182cf255729a41 (patch) | |
tree | a4dfaffc2374c62aa69e73ccd3653373485b7c8d /src/boot/ast.boot | |
parent | db9c4c7cd0c08a8b35a7d56d0279139021d8b945 (diff) | |
download | open-axiom-bb81c833c0ff2ff8df936a0cd0182cf255729a41.tar.gz |
Translate apply(f,[args]) as FUNCALL(f,args)
Diffstat (limited to 'src/boot/ast.boot')
-rw-r--r-- | src/boot/ast.boot | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/boot/ast.boot b/src/boot/ast.boot index ec3f47ce..632fdc47 100644 --- a/src/boot/ast.boot +++ b/src/boot/ast.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2014, Gabriel Dos Reis. +-- Copyright (C) 2007-2015, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -40,7 +40,7 @@ import includer namespace BOOTTRAN -module ast (quote) +module ast (quote, translateForm) ++ True means that Boot functions should be translated to use ++ hash tables to remember values. By default, functions are @@ -1471,6 +1471,23 @@ genTypeAlias(head,body) == [op,:args] := head ["DEFTYPE",op,args,backquote(body,args)] +translateForm x == + x isnt [.,:.] => x + x.op is 'QUOTE => x + x.op is 'APPLY and x.args is [fun,:args] => + lastItem args = 'NIL => + ['FUNCALL,translateForm fun,:listMap!(butLast! args,function translateForm)] + args is [['LIST,:ys]] => + ['FUNCALL,translateForm fun,:listMap!(ys, function translateForm)] + listMap!(x,function translateForm) + x.op is 'LET => + bindings := [[var, translateForm init] for [var,init] in first x.args] + [x.op,bindings,translateForm second x.args] + x is ['L%T,var,init] => [x.op,var,translateForm init] + x.op in '(PROGN LOOP RETURN) => + [x.op,:listMap!(x.args, function translateForm)] + listMap!(x,function translateForm) + --% --% Native Interface Translation --% |