Skip to content

Commit

Permalink
Symbol_table is no longer a submodule of Parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
BYVoid committed Oct 13, 2013
1 parent 32df796 commit 7d1f503
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 27 deletions.
1 change: 0 additions & 1 deletion src/bash_compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ open Core.Std
open Bash_ast

module BAST = Batsh_ast
module Symbol_table = Parser.Symbol_table

let is_arith (expr: BAST.expression) :bool =
match expr with
Expand Down
2 changes: 1 addition & 1 deletion src/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ let ast =
let ast_sexp = Batsh_ast.sexp_of_t ast in
printf "%a\n" Sexp.output_hum ast_sexp
else
let symtable_sexp = Parser.Symbol_table.sexp_of_t (Parser.symtable batsh) in
let symtable_sexp = Symbol_table.sexp_of_t (Parser.symtable batsh) in
printf "%a\n" Sexp.output_hum symtable_sexp
)

Expand Down
4 changes: 0 additions & 4 deletions src/parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ let parse (lexbuf : Lexing.lexbuf) : Batsh_ast.t =
let err = sprintf "%a: syntax error" print_position () in
raise (ParseError err)

module Symbol_table = struct
include Symbol_table
end

let create_from_lexbuf (lexbuf : Lexing.lexbuf) (filename: string) : t =
lexbuf.Lexing.lex_curr_p <- {
lexbuf.Lexing.lex_curr_p with Lexing.pos_fname = filename
Expand Down
17 changes: 0 additions & 17 deletions src/parser.mli
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
open Core.Std

type t
exception ParseError of string

module Symbol_table : sig
type t
module Scope : sig
type t
val is_function : t -> bool
val is_global_variable : t -> name: string -> bool
val add_temporary_variable : t -> Batsh_ast.identifier
val fold : t -> init: 'a -> f: (string -> bool -> 'a -> 'a) -> 'a
end
val scope : t -> string -> Scope.t
val global_scope : t -> Scope.t
val sexp_of_t : t -> Sexp.t
val is_function : t -> string -> bool
end

val create_from_file : string -> t
val create_from_channel : in_channel -> string -> t
val create_from_string : string -> t
Expand Down
17 changes: 17 additions & 0 deletions src/symbol_table.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
open Core.Std

type t

module Scope : sig
type t
val is_function : t -> bool
val is_global_variable : t -> name: string -> bool
val add_temporary_variable : t -> Batsh_ast.identifier
val fold : t -> init: 'a -> f: (string -> bool -> 'a -> 'a) -> 'a
end

val create : Batsh_ast.t -> t
val scope : t -> string -> Scope.t
val global_scope : t -> Scope.t
val sexp_of_t : t -> Sexp.t
val is_function : t -> string -> bool
2 changes: 0 additions & 2 deletions src/winbat_compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ open Core.Std
open Batsh_ast
open Winbat_ast

module Symbol_table = Parser.Symbol_table

let rec compile_leftvalue
(lvalue: Batsh_ast.leftvalue)
~(symtable: Symbol_table.t)
Expand Down
2 changes: 0 additions & 2 deletions src/winbat_transform.ml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
open Core.Std
open Batsh_ast

module Symbol_table = Parser.Symbol_table

let rec split_expression
?(no_split_top = false)
?(split_call = true)
Expand Down

0 comments on commit 7d1f503

Please sign in to comment.