standalone exapunks vm in ocaml
at main 40 lines 839 B view raw
1(* This Source Code Form is subject to the terms of the Mozilla Public 2 License, v. 2.0. If a copy of the MPL was not distributed with this 3 file, You can obtain one at https://mozilla.org/MPL/2.0/. *) 4 5open MParser 6open Exapunks 7open Host_parser 8open Utils 9 10let test str = 11 match parse_string environment str (StrSet.empty) with 12 | Success result -> 13 Printf.printf "Success: %s" 14 (show_parsed_environment result) 15 | Failed (error, _) -> Printf.printf "Failure: %s" error 16 17let () = test {| 18environment { 19 hosts { 20 home [9]; 21 f1 [4]; 22 f2 [4]; 23 f3 [4]; 24 f4 [4]; 25 f5 [4]; 26 } 27 links { 28 home [800] <-> [-1] f1; 29 f1 [1] <-> [-1] f2; 30 f2 [1] <-> [-1] f3; 31 f3 [1] <-> [-1] f4; 32 f4 [1] <-> [-1] f5; 33 } 34 files { 35 #NERV [home]; 36 #NERV [f5]; 37 199 [secret]: [foo, 1, bar, 25]; 38 } 39} 40|}