aboutsummaryrefslogtreecommitdiff
path: root/src/boot/ast.boot
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot/ast.boot')
-rw-r--r--src/boot/ast.boot21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/boot/ast.boot b/src/boot/ast.boot
index ba6c3d1d..5fe33191 100644
--- a/src/boot/ast.boot
+++ b/src/boot/ast.boot
@@ -74,7 +74,7 @@ structure Ast ==
Module(%String) -- module declaration
Import(%String) -- import module
ImportSignature(Name, Signature) -- import function declaration
- TypeAlias(Name, %List, %List) -- type alias definition
+ TypeAlias(%Head, %List) -- type alias definition
Signature(Name, Mapping) -- op: S -> T
Mapping(Ast, %List) -- (S1, S2) -> T
SuffixDot(Ast) -- x .
@@ -119,6 +119,12 @@ structure Ast ==
-- expression.
$inDefIS := false
+
+quote x ==
+ ["QUOTE",x]
+
+--%
+
bfGenSymbol: () -> %Symbol
bfGenSymbol()==
$GenVarCounter:=$GenVarCounter+1
@@ -1160,6 +1166,19 @@ bfThrow e ==
not atom first e => bpTrap()
["THROW",["QUOTE",first e],:rest e]
+--% Type alias definition
+
+backquote(form,params) ==
+ null params => quote form
+ atom form =>
+ form in params => form
+ quote form
+ ["LIST",:[backquote(t,params) for t in form]]
+
+genTypeAlias(head,body) ==
+ [op,:args] := head
+ ["DEFTYPE",op,args,backquote(body,args)]
+
--% Native datatype translation
coreSymbol: %Symbol -> %Symbol
coreSymbol s ==