Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rename Amber to Global

  • Loading branch information...
commit 22277be4cde33ef895a0a1305cb1fd95fd497a75 1 parent 95f4af5
nineties authored
View
8 demo/lang/hyperlisp/lib/lambda.ab
@@ -1,6 +1,6 @@
# Copyright (C) 2012 nineties
#
-# $Id: hyperlisp/symbol.ab 2013-03-07 00:42:59 nineties $
+# $Id: hyperlisp/symbol.ab 2013-03-09 01:01:10 nineties $
# Reference
# Masahiko Sato and Masami Hagiya: HyperLisp, Algorithmic Languages
@@ -193,7 +193,7 @@ module HyperLisp {
# compile lambda-abstraction as a native function of Amber.
compile_lambda_jit(x):
- Amber::compile(`Lambda{x, !compile_eval(params(x), body(x))})
+ Global::compile(`Lambda{x, !compile_eval(params(x), body(x))})
# compile label-expression as a sexp.
compile_label(x):
@@ -216,7 +216,7 @@ module HyperLisp {
lam: replace_label(name, params(x), body(x))
fun : compile_eval(params(lam), body(lam))
# register compiled function to the function table.
- function[name] = Amber::compile(`Lambda{x, !fun})
+ function[name] = Global::compile(`Lambda{x, !fun})
## Function definition
@@ -236,7 +236,7 @@ module HyperLisp {
sym: x.cdr.car
lam: x.cdr.cdr.car
fun: compile_lambda_jit(lam)
- Amber::define_global_variable(rename(sym), fun)
+ Global::define_global_variable(rename(sym), fun)
sym
}
eval_(x) when x.car == \Meta{Delta}: eval_define(x)
View
133 rowl1/rowl1-compile.rlc
@@ -2,7 +2,7 @@
; rowl - 1st generation
; Copyright (C) 2010 nineties
;
-; $Id: rowl1-compile.rlc 2013-03-08 21:38:36 nineties $
+; $Id: rowl1-compile.rlc 2013-03-09 00:50:53 nineties $
;
(import "rlvm-compile")
@@ -2046,101 +2046,102 @@
(return (alloc_function 0 (get_code asm) 0))
))
-(export fun setup_builtin_compilers (mod) (
+(extern object global)
+(export fun setup_builtin_compilers () (
(var locT (domainP Loc))
- (add_function1 mod Compile DontCare compile_ 0)
+ (add_function1 global Compile DontCare compile_ 0)
- (add_compiler mod DontCare compile_error)
- (add_compiler mod (make_object2 Located locT DontCare) compile_located)
+ (add_compiler global DontCare compile_error)
+ (add_compiler global (make_object2 Located locT DontCare) compile_located)
; These commands have been evaluated in parsing phase.
- (add_compiler mod (make_object1 Open DontCare) topscope_only)
- (add_compiler mod (make_object1 Import DontCare) topscope_only)
+ (add_compiler global (make_object1 Open DontCare) topscope_only)
+ (add_compiler global (make_object1 Import DontCare) topscope_only)
- (add_compiler mod (make_object2 Qualified DontCare symT) compile_qualified)
+ (add_compiler global (make_object2 Qualified DontCare symT) compile_qualified)
- (add_compiler mod (make_object2 MakeObject DontCare DontCare) compile_make_object)
+ (add_compiler global (make_object2 MakeObject DontCare DontCare) compile_make_object)
- (add_compiler mod (make_object2 DefVariable DontCare DontCare) compile_define_variable)
- (add_compiler mod (make_object3 DefVariable DontCare DontCare (quote (to_sym "overwrite"))) compile_define_variable)
+ (add_compiler global (make_object2 DefVariable DontCare DontCare) compile_define_variable)
+ (add_compiler global (make_object3 DefVariable DontCare DontCare (quote (to_sym "overwrite"))) compile_define_variable)
- (add_compiler mod (make_object2 DefFunction DontCare DontCare) compile_define_function)
+ (add_compiler global (make_object2 DefFunction DontCare DontCare) compile_define_function)
- (add_compiler mod symT compile_var)
- (add_compiler mod (quote @C_TRUE) compile_special)
- (add_compiler mod (quote @C_FALSE) compile_special)
- (add_compiler mod (quote @C_NIL) compile_special)
- (add_compiler mod (quote @C_UNDEF) compile_special)
- (add_compiler mod intT compile_const_int)
- (add_compiler mod stringT compile_const)
- (add_compiler mod bintT compile_const)
- (add_compiler mod (domainP Float) compile_const)
+ (add_compiler global symT compile_var)
+ (add_compiler global (quote @C_TRUE) compile_special)
+ (add_compiler global (quote @C_FALSE) compile_special)
+ (add_compiler global (quote @C_NIL) compile_special)
+ (add_compiler global (quote @C_UNDEF) compile_special)
+ (add_compiler global intT compile_const_int)
+ (add_compiler global stringT compile_const)
+ (add_compiler global bintT compile_const)
+ (add_compiler global (domainP Float) compile_const)
- (add_compiler mod (make_object2 Apply DontCare listT) compile_apply)
+ (add_compiler global (make_object2 Apply DontCare listT) compile_apply)
- (add_compiler mod (qquote (unquote (unquote DontCare))) compile_unquote)
- (add_compiler mod (qquote (quote (unquote DontCare))) compile_quote)
- (add_compiler mod (qquote (qquote (unquote (unquote DontCare)))) compile_qquote)
+ (add_compiler global (qquote (unquote (unquote DontCare))) compile_unquote)
+ (add_compiler global (qquote (quote (unquote DontCare))) compile_quote)
+ (add_compiler global (qquote (qquote (unquote (unquote DontCare)))) compile_qquote)
- (add_compiler mod (domainP List) compile_list)
- (add_compiler mod (domainP Tuple) compile_tuple)
- (add_compiler mod (domainP Array) compile_array)
- (add_compiler mod (domainP Range) compile_range)
+ (add_compiler global (domainP List) compile_list)
+ (add_compiler global (domainP Tuple) compile_tuple)
+ (add_compiler global (domainP Array) compile_array)
+ (add_compiler global (domainP Range) compile_range)
- (add_compiler mod (make_object1 Block listT) compile_block)
- (add_compiler mod (make_object1 Seq listT) compile_seq)
- (add_compiler mod (make_object1 Breakable listT) compile_breakable)
+ (add_compiler global (make_object1 Block listT) compile_block)
+ (add_compiler global (make_object1 Seq listT) compile_seq)
+ (add_compiler global (make_object1 Breakable listT) compile_breakable)
- (add_compiler mod (mkif DontCare DontCare) compile_if)
- (add_compiler mod (ifelse DontCare DontCare DontCare) compile_ifelse)
- (add_compiler mod (make_object2 While DontCare DontCare) compile_while)
- (add_compiler mod (make_object3 While DontCare DontCare DontCare) compile_while)
+ (add_compiler global (mkif DontCare DontCare) compile_if)
+ (add_compiler global (ifelse DontCare DontCare DontCare) compile_ifelse)
+ (add_compiler global (make_object2 While DontCare DontCare) compile_while)
+ (add_compiler global (make_object3 While DontCare DontCare DontCare) compile_while)
- (add_compiler mod (make_object3 For DontCare DontCare DontCare)
+ (add_compiler global (make_object3 For DontCare DontCare DontCare)
compile_for
)
- (add_compiler mod (make_object3 RevFor DontCare DontCare DontCare)
+ (add_compiler global (make_object3 RevFor DontCare DontCare DontCare)
compile_revfor
)
- (add_compiler mod (make_object3 For DontCare
+ (add_compiler global (make_object3 For DontCare
(make_object2 Range DontCare DontCare) DontCare)
compile_range_for)
- (add_compiler mod (make_object3 RevFor DontCare
+ (add_compiler global (make_object3 RevFor DontCare
(make_object2 Range DontCare DontCare) DontCare)
compile_range_revfor)
- (add_compiler mod (make_object0 Break) compile_break)
- (add_compiler mod (make_object0 Continue) compile_continue)
- (add_compiler mod (make_object1 Return DontCare) compile_return)
- (add_compiler mod (make_object2 Try DontCare DontCare) compile_try)
- (add_compiler mod (make_object1 Throw DontCare) compile_throw)
-
- (add_compiler mod (make_object2 Equal DontCare DontCare) compile_eq)
- (add_compiler mod (make_object2 NotEqual DontCare DontCare) compile_ne)
- (add_compiler mod (make_object1 Not DontCare) compile_logical)
- (add_compiler mod (make_object2 SeqAnd DontCare DontCare) compile_logical)
- (add_compiler mod (make_object2 SeqOr DontCare DontCare) compile_logical)
-
- (add_compiler mod (make_object2 Assign DontCare DontCare) compile_assign)
- (add_compiler mod (make_object2 Lambda DontCare DontCare) compile_lambda)
- (add_compiler mod (make_object2 Fusion DontCare DontCare) compile_fusion)
-
- (add_compiler mod (make_object2 Slot DontCare symT) compile_slot)
- (add_compiler mod (make_object3 Slot DontCare symT listT) compile_slot2)
- (add_compiler mod (assign (make_object2 Slot DontCare symT) DontCare)
+ (add_compiler global (make_object0 Break) compile_break)
+ (add_compiler global (make_object0 Continue) compile_continue)
+ (add_compiler global (make_object1 Return DontCare) compile_return)
+ (add_compiler global (make_object2 Try DontCare DontCare) compile_try)
+ (add_compiler global (make_object1 Throw DontCare) compile_throw)
+
+ (add_compiler global (make_object2 Equal DontCare DontCare) compile_eq)
+ (add_compiler global (make_object2 NotEqual DontCare DontCare) compile_ne)
+ (add_compiler global (make_object1 Not DontCare) compile_logical)
+ (add_compiler global (make_object2 SeqAnd DontCare DontCare) compile_logical)
+ (add_compiler global (make_object2 SeqOr DontCare DontCare) compile_logical)
+
+ (add_compiler global (make_object2 Assign DontCare DontCare) compile_assign)
+ (add_compiler global (make_object2 Lambda DontCare DontCare) compile_lambda)
+ (add_compiler global (make_object2 Fusion DontCare DontCare) compile_fusion)
+
+ (add_compiler global (make_object2 Slot DontCare symT) compile_slot)
+ (add_compiler global (make_object3 Slot DontCare symT listT) compile_slot2)
+ (add_compiler global (assign (make_object2 Slot DontCare symT) DontCare)
compile_slotset)
; internal expressions
- (add_compiler mod (make_object2 FieldRef DontCare intT) compile_fieldref)
- (add_compiler mod (make_object2 Assign (make_object2 FieldRef DontCare intT) DontCare) compile_fieldref_assign)
+ (add_compiler global (make_object2 FieldRef DontCare intT) compile_fieldref)
+ (add_compiler global (make_object2 Assign (make_object2 FieldRef DontCare intT) DontCare) compile_fieldref_assign)
- (add_compiler mod (make_object1 AllocClsEnv intT) compile_alloc_clsenv)
- (add_compiler mod (make_object2 Closure DontCare DontCare) compile_closure)
- (add_compiler mod (make_object3 Ref DontCare intT symT) compile_clsref)
- (add_compiler mod (make_object2 Assign
+ (add_compiler global (make_object1 AllocClsEnv intT) compile_alloc_clsenv)
+ (add_compiler global (make_object2 Closure DontCare DontCare) compile_closure)
+ (add_compiler global (make_object3 Ref DontCare intT symT) compile_clsref)
+ (add_compiler global (make_object2 Assign
(make_object3 Ref DontCare intT symT) DontCare) compile_clsref_assign)
- (add_compiler mod (quote Decons) compile_decons)
+ (add_compiler global (quote Decons) compile_decons)
))
(export fun add_compiler (mod pat func) (
View
100 rowl1/rowl1-interp.rlc
@@ -2,7 +2,7 @@
; rowl - 1st generation
; Copyright (C) 2010 nineties
;
-; $Id: rowl1-interp.rlc 2013-03-05 05:41:36 nineties $
+; $Id: rowl1-interp.rlc 2013-03-09 00:55:06 nineties $
;
(import "rlvm-compile")
@@ -20,12 +20,12 @@
(import "rowl1-error")
(import "rowl1-pprint")
-(export var amber_mod null)
+(export var global null)
(export var current_loc null)
(export var current_mod null)
(export fun set_loc (loc) (
(= current_loc loc)
- (add_module_variable amber_mod (to_sym "LOCATION") @C_TRUE loc)
+ (add_module_variable global (to_sym "LOCATION") @C_TRUE loc)
))
(var module_stack null)
@@ -35,7 +35,7 @@
(throw (type_error current_loc (string "module") mod))
)
(= current_mod mod)
- (add_module_variable amber_mod (to_sym "MODULE") @C_TRUE mod)
+ (add_module_variable global (to_sym "MODULE") @C_TRUE mod)
))
(export fun eval_shell () (
@@ -68,24 +68,24 @@
(export fun eval_main (file ichan argc argv) (
;(var start (gettimeofday))
- (= amber_mod (make_module 0 (to_sym "amber")))
- (add_module_variable amber_mod (to_sym "Amber") @C_TRUE amber_mod)
+ (= global (make_module 0 (to_sym "Global")))
+ (add_module_variable global (to_sym "Global") @C_TRUE global)
- (= module_stack (cons amber_mod 0))
+ (= module_stack (cons global 0))
(= current_loc no_loc)
(setup_argv argc argv)
- (setup_globals amber_mod)
- (setup_builtin_compilers amber_mod)
- (init_stdlib amber_mod)
- (open_module amber_mod (to_sym "Std"))
- (open_module amber_mod (qualified "Std" (to_sym "IO")))
+ (setup_globals)
+ (setup_builtin_compilers)
+ (init_stdlib)
+ (open_module global (to_sym "Std"))
+ (open_module global (qualified "Std" (to_sym "IO")))
- (init_parser_funcs amber_mod)
+ (init_parser_funcs)
- (= current_mod amber_mod)
- (= current_loc no_loc)
+ (set_current_module global)
+ (set_loc no_loc)
(push_import_dir "/usr/lib/amber/")
(import_file "amber/syntax.ab")
@@ -126,12 +126,12 @@
))
(fun eval (expr) (
- (return (call1 Eval expr))
+ (return (byterun (lookup_func global Eval) expr))
))
(extern fun list_to_table)
(fun rewrite (expr) (
- (var new_expr (call1 Rewrite expr))
+ (var new_expr (byterun (lookup_func global Rewrite) expr))
(if (== new_expr @C_UNDEF) (= new_expr expr))
(if (!= new_expr expr) (return (rewrite new_expr)))
(= expr new_expr)
@@ -244,7 +244,7 @@
(fun interpret_shell (p) (
(var outputs (ary_new))
(enable_shell_syntax)
- (add_module_variable amber_mod (to_sym "shell_outputs") @C_TRUE outputs)
+ (add_module_variable global (to_sym "shell_outputs") @C_TRUE outputs)
(ary_push outputs @C_UNDEF)
(while 1 (do
(try
@@ -297,7 +297,7 @@
))
(export fun eval_end_module (expr) (
- (if (== current_mod amber_mod)
+ (if (== current_mod global)
(throw (exception current_mod (string "there is no module to close")))
)
(if (! (in_top_scope current_mod))
@@ -476,7 +476,7 @@
(fun setup_argv (argc argv) (
(var ARGV (ary_new))
- (add_module_variable amber_mod (to_sym "ARGV") @C_FALSE ARGV)
+ (add_module_variable global (to_sym "ARGV") @C_FALSE ARGV)
(if (== argc 0) return)
(for i 1 argc (do
(ary_push ARGV (string (array_get string argv i)))
@@ -527,39 +527,39 @@
(throw (not_found current_loc (string path)))
))
-(fun setup_globals (mod) (
- (add_module_variable mod (to_sym "LOCATION") @C_FALSE current_loc)
- (add_module_variable mod (to_sym "MODULE") @C_FALSE current_mod)
- (add_module_variable mod (to_sym "PROMPT") @C_FALSE (string "amber"))
+(fun setup_globals () (
+ (add_module_variable global (to_sym "LOCATION") @C_FALSE current_loc)
+ (add_module_variable global (to_sym "MODULE") @C_FALSE current_mod)
+ (add_module_variable global (to_sym "PROMPT") @C_FALSE (string "amber"))
(if (in_shell_mode)
- (add_module_variable mod (to_sym "shell_mode") @C_FALSE @C_TRUE)
- (add_module_variable mod (to_sym "shell_mode") @C_FALSE @C_FALSE)
+ (add_module_variable global (to_sym "shell_mode") @C_FALSE @C_TRUE)
+ (add_module_variable global (to_sym "shell_mode") @C_FALSE @C_FALSE)
)
- (add_function1 mod Rewrite (domainP Located) rewrite_located 0)
- (add_function1 mod Eval DontCare default_eval 0)
- (add_function1 mod Eval (domainP Located) eval_located 0)
- (add_function1 mod Eval (make_object1 Open DontCare) eval_open 0)
- (add_function1 mod Eval (make_object1 Import listT) eval_import 0)
- (add_function1 mod Eval (make_object1 Import stringT) eval_import 0)
- (add_function1 mod Eval (make_object1 BeginModule symT) eval_begin_module 0)
- (add_function1 mod Eval (make_object1 BeginModule (domainP Qualified)) eval_begin_module 0)
- (add_function1 mod Eval (make_object0 EndModule) eval_end_module 0)
- (add_function1 mod Eval (make_object1 Seq listT) eval_seq 0)
-
- (add_function1 mod Eval (make_object2 DefSyntax symT DontCare) eval_define_syntax 0)
- (add_function1 mod Eval (domainP ReserveSymbol) eval_reserve_symbol 0)
-
- (add_function1 mod Eval (quote (to_sym "exit")) eval_exit 0)
-
- (add_function1 mod (to_sym "load") stringT load_ 0)
- (add_function1 mod (to_sym "import") stringT import_file 0)
- (add_function1 mod (to_sym "exit") intT exit_ 0)
- (add_function1 mod (to_sym "atexit") funT at_exit 0)
-
- (add_function2 mod (to_sym "define_global_variable")
+ (add_function1 global Rewrite (domainP Located) rewrite_located 0)
+ (add_function1 global Eval DontCare default_eval 0)
+ (add_function1 global Eval (domainP Located) eval_located 0)
+ (add_function1 global Eval (make_object1 Open DontCare) eval_open 0)
+ (add_function1 global Eval (make_object1 Import listT) eval_import 0)
+ (add_function1 global Eval (make_object1 Import stringT) eval_import 0)
+ (add_function1 global Eval (make_object1 BeginModule symT) eval_begin_module 0)
+ (add_function1 global Eval (make_object1 BeginModule (domainP Qualified)) eval_begin_module 0)
+ (add_function1 global Eval (make_object0 EndModule) eval_end_module 0)
+ (add_function1 global Eval (make_object1 Seq listT) eval_seq 0)
+
+ (add_function1 global Eval (make_object2 DefSyntax symT DontCare) eval_define_syntax 0)
+ (add_function1 global Eval (domainP ReserveSymbol) eval_reserve_symbol 0)
+
+ (add_function1 global Eval (quote (to_sym "exit")) eval_exit 0)
+
+ (add_function2 global (to_sym "define_global_variable")
symT DontCare def_global_var 0)
+
+ (add_function1 global (to_sym "load") stringT load_ 0)
+ (add_function1 global (to_sym "import") stringT import_file 0)
+ (add_function1 global (to_sym "exit") intT exit_ 0)
+ (add_function1 global (to_sym "atexit") funT at_exit 0)
))
(extern fun setup_pprint)
@@ -579,8 +579,8 @@
(extern fun setup_oop)
(extern fun setup_gc)
-(fun init_stdlib (mod) (
- (var std (create_module mod (to_sym "Std")))
+(fun init_stdlib () (
+ (var std (create_module global (to_sym "Std")))
(setup_pprint std)
(setup_base std)
(setup_symbol std)
View
5 rowl1/rowl1-packrat.rlc
@@ -2,7 +2,7 @@
; rowl - 1st generation
; Copyright (C) 2010 nineties
;
-; $Id: rowl1-packrat.rlc 2013-03-08 22:08:02 nineties $
+; $Id: rowl1-packrat.rlc 2013-03-09 00:38:51 nineties $
;
(import "rlvm-compile")
@@ -1972,7 +1972,8 @@
(to_sym "Shell"))
))
-(export fun init_parser_funcs (global) (
+(extern object global)
+(export fun init_parser_funcs () (
(= parser_mod (make_module global (to_sym "Parser")))
(add_function1 parser_mod (to_sym "%get_column") DontCare get_column 0)
(add_function2 parser_mod (to_sym "%set_indent") DontCare DontCare set_indent 0)
Please sign in to comment.
Something went wrong with that request. Please try again.