Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewagner committed Aug 21, 2015
1 parent 60a90e7 commit 88fd45a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 2 additions & 4 deletions ml-proto/src/memory.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ let create n =
mem

let init_seg mem seg =
(*
* The Check.check_data_segment ensures seg is in bounds.
* There currently is no way to blit from a string.
*)
if String.length seg.data > Array1.dim mem then raise Bounds;
(* There currently is no way to blit from a string. *)
for i = 0 to String.length seg.data - 1 do
(view mem : char_view).{seg.addr + i} <- seg.data.[i]
done
Expand Down
9 changes: 4 additions & 5 deletions ml-proto/src/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ bind_var :
| VAR { $1 @@ at() }
;
segment :
| INT TEXT { {Memory.addr = int_of_string $1; Memory.data = $2} @@ at() }
data :
| LPAR DATA INT TEXT RPAR { {Memory.addr = int_of_string $3; Memory.data = $4} @@ at() }
;
expr :
Expand Down Expand Up @@ -285,9 +285,8 @@ module_fields :
| LPAR MEMORY INT RPAR module_fields /* Sugar */
{ fun c -> let m = $5 c in
{m with memory = (int_of_string $3, int_of_string $3)} }
| LPAR DATA segment RPAR module_fields
{ fun c -> let m = $5 c in
{m with data = $3 :: m.data} }
| data module_fields
{ fun c -> let m = $2 c in {m with data = $1 :: m.data} }
;
modul :
| LPAR MODULE module_fields RPAR { $3 c0 @@ at() }
Expand Down

0 comments on commit 88fd45a

Please sign in to comment.