diff options
author | pacien | 2018-04-29 20:41:39 +0200 |
---|---|---|
committer | pacien | 2018-04-29 20:41:39 +0200 |
commit | 97a5d3600a06e2edbd6bb6faa6fa0728add0d5d3 (patch) | |
tree | a859ae11723730440de10569a2d4081e13ceab49 /src/parser.ml | |
parent | 0647f37eebbefb8446fc8abfc533a23952fbb8be (diff) | |
download | urm-97a5d3600a06e2edbd6bb6faa6fa0728add0d5d3.tar.gz |
Rename URM types and fix urm_from_eurm signature
Diffstat (limited to 'src/parser.ml')
-rw-r--r-- | src/parser.ml | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/parser.ml b/src/parser.ml index 1f367d1..0bc1be6 100644 --- a/src/parser.ml +++ b/src/parser.ml | |||
@@ -14,10 +14,10 @@ let rec string_of_file f = | |||
14 | let rec program_of_lex = function | 14 | let rec program_of_lex = function |
15 | | [] -> [] | 15 | | [] -> [] |
16 | | instr :: tail -> match (String.lowercase_ascii instr) :: tail with | 16 | | instr :: tail -> match (String.lowercase_ascii instr) :: tail with |
17 | | "zero" :: arg_1 :: tail -> (Zero (int_of_string arg_1)) :: (program_of_lex tail) | 17 | | "zero" :: arg_1 :: tail -> (URMZero (int_of_string arg_1)) :: (program_of_lex tail) |
18 | | "succ" :: arg_1 :: tail -> (Succ (int_of_string arg_1)) :: (program_of_lex tail) | 18 | | "succ" :: arg_1 :: tail -> (URMSucc (int_of_string arg_1)) :: (program_of_lex tail) |
19 | | "copy" :: arg_1 :: arg_2 :: tail -> (Copy ((int_of_string arg_1), (int_of_string arg_2))) :: (program_of_lex tail) | 19 | | "copy" :: arg_1 :: arg_2 :: tail -> (URMCopy ((int_of_string arg_1), (int_of_string arg_2))) :: (program_of_lex tail) |
20 | | "jump" :: arg_1 :: arg_2 :: arg_3 :: tail -> (Jump ((int_of_string arg_1), (int_of_string arg_2), (int_of_string arg_3))) :: (program_of_lex tail) | 20 | | "jump" :: arg_1 :: arg_2 :: arg_3 :: tail -> (URMJump ((int_of_string arg_1), (int_of_string arg_2), (int_of_string arg_3))) :: (program_of_lex tail) |
21 | | _ -> raise Syntax_error | 21 | | _ -> raise Syntax_error |
22 | 22 | ||
23 | (* FIXME: reject multiple definition of a single register *) | 23 | (* FIXME: reject multiple definition of a single register *) |
@@ -29,4 +29,3 @@ let rec regs_of_lex = function | |||
29 | let seq_from_string lexer_func str = Str.split (Str.regexp "[\t\n(), ]+") str |> lexer_func | 29 | let seq_from_string lexer_func str = Str.split (Str.regexp "[\t\n(), ]+") str |> lexer_func |
30 | let program_of_string = seq_from_string program_of_lex | 30 | let program_of_string = seq_from_string program_of_lex |
31 | let regs_of_string = seq_from_string regs_of_lex | 31 | let regs_of_string = seq_from_string regs_of_lex |
32 | |||