scope_analysis: changed convert to return the global symbol table as well as the program
This commit is contained in:
@@ -132,8 +132,10 @@ let convert program =
|
|||||||
| (Core_ast.Expr e) :: rest -> (analyze tbl [] e) :: (aux tbl rest)
|
| (Core_ast.Expr e) :: rest -> (analyze tbl [] e) :: (aux tbl rest)
|
||||||
| (Define (s, e)) :: rest ->
|
| (Define (s, e)) :: rest ->
|
||||||
let tbl = SymbolTable.add s (id ()) tbl in
|
let tbl = SymbolTable.add s (id ()) tbl in
|
||||||
(analyze tbl [] e) :: (aux tbl rest)
|
(analyze tbl [] (Set (s, e))) :: (aux tbl rest)
|
||||||
in traverse (fun x -> x) (aux SymbolTable.empty program)
|
in
|
||||||
|
let* program = traverse (fun x -> x) (aux SymbolTable.empty program) in
|
||||||
|
Ok (program, global_tbl)
|
||||||
|
|
||||||
let of_src src =
|
let of_src src =
|
||||||
let* core = (Core_ast.of_src src) in
|
let* core = (Core_ast.of_src src) in
|
||||||
|
|||||||
Reference in New Issue
Block a user