diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2013-10-31 18:15:01 +0100 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2013-10-31 18:15:01 +0100 |
commit | f253f98136def21b5e50c5922246e2ddfe315442 (patch) | |
tree | 5ba21cf7a697bccaf58bf8072cb4c283be85a84e /camlsim/netlist.ml | |
parent | 0b269f32dd9b8d349f94793dad44e728473e9f0a (diff) | |
download | SystDigit-Projet-f253f98136def21b5e50c5922246e2ddfe315442.tar.gz SystDigit-Projet-f253f98136def21b5e50c5922246e2ddfe315442.zip |
Simulator started.
Diffstat (limited to 'camlsim/netlist.ml')
-rw-r--r-- | camlsim/netlist.ml | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/camlsim/netlist.ml b/camlsim/netlist.ml new file mode 100644 index 0000000..b1d7932 --- /dev/null +++ b/camlsim/netlist.ml @@ -0,0 +1,17 @@ +exception Parse_error of string + +let find_file filename = + try + open_in filename + with + | _ -> raise (Parse_error "No such file '%s'") + +let read_file filename = + let ic = find_file filename in + let lexbuf = Lexing.from_channel ic in + lexbuf.Lexing.lex_curr_p <- { lexbuf.Lexing.lex_curr_p with Lexing.pos_fname = filename }; + try + Netlist_parser.program Netlist_lexer.token lexbuf + with + | e -> raise (Parse_error ("Syntax error (exception: "^(Printexc.to_string e)^")")) + |