diff options
author | dos-reis <gdr@axiomatics.org> | 2013-06-02 08:46:56 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2013-06-02 08:46:56 +0000 |
commit | 486d78fbea91e07509bc81249c44ae6014ef1d46 (patch) | |
tree | adbf1e1c3c7ebf8bbbcfc621c187787505cf3736 /src/interp/compiler.boot | |
parent | c3af9dc192b5fa2ced867c777dcaa4c09cfa48ad (diff) | |
download | open-axiom-486d78fbea91e07509bc81249c44ae6014ef1d46.tar.gz |
Make parser non-dependent on constructor databases.
Diffstat (limited to 'src/interp/compiler.boot')
-rw-r--r-- | src/interp/compiler.boot | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index 3bcb0399..e6b9f2c8 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -2797,6 +2797,30 @@ preprocessParseTree pt == displayPreCompilationErrors() nil +++ Mutate parse form `pf' so that references to niladic constructors +++ appear in instantiation form. +instantiateNiladics! pf == + ident? pf and niladicConstructor? pf => [pf] + do + pf isnt [.,:.] or pf.op is 'QUOTE => nil + pf.op in '(DEF MDEF) => + -- Note: Normally, we wouldn't want to touch the definiendum; + -- except that some operators such as 'case' take flags, + -- so we want to solve them if they are types. + if second(pf) is [.,:.] then + second(pf).args := instantiateNiladicsInList! second(pf).args + third(pf) := instantiateNiladicsInList! third pf + fourth(pf) := instantiateNiladics! fourth pf + pf.op is 'SIGNATURE => third(pf) := instantiateNiladicsInList! third pf + pf.op isnt [.,:.] => pf.args := instantiateNiladicsInList! pf.args + instantiateNiladicsInList! pf + pf + +instantiateNiladicsInList! l == + for xs in tails l repeat + xs.first := instantiateNiladics! first xs + l + ++ Takes a parse tree `pt', typecheck it and compile it down ++ to VM instructions. compileParseTree pt == @@ -2815,6 +2839,7 @@ compileParseTree pt == $returnMode: local := $EmptyMode $exitModeStack: local := [] -- Used by the compiler proper $leaveLevelStack: local := [] + pf := instantiateNiladics! pf if T := compTopLevel(pf,$EmptyMode,$InteractiveFrame) then $InteractiveFrame := T.env finishLine $OutputStream |