Skip to content

Commit 690bde3

Browse files
committed
Added 'sexplib'
1 parent 2c72f2a commit 690bde3

13 files changed

+74
-62
lines changed

_oasis

+9-6
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,22 @@ Flag strict
1818
Library llama_man
1919
Path: lib_src
2020
CompiledObject: best
21-
Modules: Types,
22-
Compiler
21+
Modules: Gcc_types,
22+
Gcc_compiler
2323
if flag(strict)
2424
NativeOpt: -w @a -warn-error -a
2525
ByteOpt: -w @a -warn-error -a
2626
BuildDepends: core_kernel
27+
sexplib,
28+
sexplib.syntax,
2729

2830
Executable gcc
2931
Path: bin_src
30-
MainIs: main.ml # rename?
32+
MainIs: gcc.ml
3133
CompiledObject: best
3234
Install: true
33-
BuildDepends: llama_man
35+
BuildDepends: llama_man,
36+
sexplib
3437

3538
Executable test_runner
3639
Path: lib_test
@@ -39,5 +42,5 @@ Executable test_runner
3942
Custom: true
4043
CompiledObject: best
4144
Install: false
42-
BuildDepends: llama_man
43-
, oUnit (>= 2.0.0)
45+
BuildDepends: llama_man,
46+
oUnit (>= 2.0.0)

_tags

+25-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# OASIS_START
2-
# DO NOT EDIT (digest: 41650a373911173129593549eeaaf4b9)
2+
# DO NOT EDIT (digest: 625cb8920b31261e65753b003f41336e)
33
# Ignore VCS directories, you can use the same kind of rule outside
44
# OASIS_START/STOP if you want to exclude directories that contains
55
# useless stuff for the build process
@@ -19,18 +19,36 @@
1919
<lib_src/*.ml{,i}>: oasis_library_llama_man_byte
2020
<lib_src/llama_man.{cma,cmxa}>: oasis_library_llama_man_native
2121
<lib_src/*.ml{,i}>: oasis_library_llama_man_native
22-
<lib_src/*.ml{,i}>: package(core_kernel)
22+
<lib_src/*.ml{,i}>: package()
23+
<lib_src/*.ml{,i}>: package(core_kernel
24+
sexplib)
25+
<lib_src/*.ml{,i}>: package(sexplib.syntax)
2326
# Executable gcc
24-
<bin_src/main.{native,byte}>: package(core_kernel)
25-
<bin_src/main.{native,byte}>: use_llama_man
26-
<bin_src/*.ml{,i}>: package(core_kernel)
27+
<bin_src/gcc.{native,byte}>: package()
28+
<bin_src/gcc.{native,byte}>: package(core_kernel
29+
sexplib)
30+
<bin_src/gcc.{native,byte}>: package(sexplib)
31+
<bin_src/gcc.{native,byte}>: package(sexplib.syntax)
32+
<bin_src/gcc.{native,byte}>: use_llama_man
33+
<bin_src/*.ml{,i}>: package()
34+
<bin_src/*.ml{,i}>: package(core_kernel
35+
sexplib)
36+
<bin_src/*.ml{,i}>: package(sexplib)
37+
<bin_src/*.ml{,i}>: package(sexplib.syntax)
2738
<bin_src/*.ml{,i}>: use_llama_man
2839
# Executable test_runner
29-
<lib_test/test_runner.{native,byte}>: package(core_kernel)
40+
<lib_test/test_runner.{native,byte}>: package()
41+
<lib_test/test_runner.{native,byte}>: package(core_kernel
42+
sexplib)
3043
<lib_test/test_runner.{native,byte}>: package(oUnit)
44+
<lib_test/test_runner.{native,byte}>: package(sexplib.syntax)
3145
<lib_test/test_runner.{native,byte}>: use_llama_man
32-
<lib_test/*.ml{,i}>: package(core_kernel)
46+
<lib_test/*.ml{,i}>: package()
47+
<lib_test/*.ml{,i}>: package(core_kernel
48+
sexplib)
3349
<lib_test/*.ml{,i}>: package(oUnit)
50+
<lib_test/*.ml{,i}>: package(sexplib.syntax)
3451
<lib_test/*.ml{,i}>: use_llama_man
3552
<lib_test/test_runner.{native,byte}>: custom
3653
# OASIS_STOP
54+
<lib_src/*.ml{,i}>: syntax_camlp4o

bin_src/gcc.ml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
open Sexplib
2+
3+
open Gcc_types
4+
5+
let () =
6+
let sexp = Sexp.input_sexp stdin in
7+
let expr = expr_of_sexp sexp in
8+
let open Gcc_compiler in
9+
compile expr |> assemble |> print_endline

bin_src/main.ml

-16
This file was deleted.

lib_src/META

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# OASIS_START
2-
# DO NOT EDIT (digest: 77f81335e4d057100d68e2545a139853)
2+
# DO NOT EDIT (digest: 303cc0010832e896a89c08342b8777ac)
33
version = "2014"
44
description = "ICFPC"
5-
requires = "core_kernel"
5+
requires = "core_kernel sexplib sexplib.syntax "
66
archive(byte) = "llama_man.cma"
77
archive(byte, plugin) = "llama_man.cma"
88
archive(native) = "llama_man.cmxa"

lib_src/compiler.mli

-5
This file was deleted.

lib_src/compiler.ml renamed to lib_src/gcc_compiler.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
open Core_kernel.Std
22

3-
open Types
3+
open Gcc_types
44

5-
type code = Types.instruction list
5+
type code = instruction list
66

77
type env = {
88
vars : var list;

lib_src/types.ml renamed to lib_src/gcc_types.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ let is_phony = function
3939
| LABEL _ | COMMENT _ -> true
4040
| _ -> false
4141

42-
type var = string
42+
type var = string with sexp
4343

4444
type expr =
4545
| Const of int
@@ -57,4 +57,4 @@ type expr =
5757
| Var of var
5858
| Car of expr
5959
| Cdr of expr
60-
(* | Call of expr * expr list *)
60+
with sexp

lib_src/llama_man.mldylib

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# OASIS_START
2-
# DO NOT EDIT (digest: 024da795f60335c7b36cece02d6f3960)
3-
Types
4-
Compiler
2+
# DO NOT EDIT (digest: 0392e096655bdc580a7d9762ef730087)
3+
Gcc_types
4+
Gcc_compiler
55
# OASIS_STOP

lib_src/llama_man.mllib

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# OASIS_START
2-
# DO NOT EDIT (digest: 024da795f60335c7b36cece02d6f3960)
3-
Types
4-
Compiler
2+
# DO NOT EDIT (digest: 0392e096655bdc580a7d9762ef730087)
3+
Gcc_types
4+
Gcc_compiler
55
# OASIS_STOP

lib_src/stdlib.ml

-6
This file was deleted.

lib_test/gcc_test.ml

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ open Core_kernel.Std
22

33
open OUnit2
44

5-
open Types
6-
open Compiler
7-
open Stdlib
5+
open Gcc_types
6+
7+
let scope name var expr = Call (Fn ([name], expr), [var])
88

99

1010
let test_gcc ~ast ~path =
11+
let open Gcc_compiler in
1112
let asm = compile ast |> assemble
1213
and expected = In_channel.read_all path
1314
in assert_equal ~printer:(sprintf "%S") expected asm

setup.ml

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(* setup.ml generated for the first time by OASIS v0.4.4 *)
22

33
(* OASIS_START *)
4-
(* DO NOT EDIT (digest: 22f9ded569f2014f1cc40a7e4cb20150) *)
4+
(* DO NOT EDIT (digest: c77a54a4395ba4ba8bb9b4f87a7f95ab) *)
55
(*
66
Regenerated by OASIS v0.4.4
77
Visit http://oasis.forge.ocamlcore.org for more information and
@@ -6718,7 +6718,11 @@ let setup_t =
67186718
bs_path = "lib_src";
67196719
bs_compiled_object = Best;
67206720
bs_build_depends =
6721-
[FindlibPackage ("core_kernel", None)];
6721+
[
6722+
FindlibPackage ("core_kernel\nsexplib", None);
6723+
FindlibPackage ("sexplib.syntax", None);
6724+
FindlibPackage ("", None)
6725+
];
67226726
bs_build_tools = [ExternalTool "ocamlbuild"];
67236727
bs_c_sources = [];
67246728
bs_data_files = [];
@@ -6740,7 +6744,7 @@ let setup_t =
67406744
]
67416745
},
67426746
{
6743-
lib_modules = ["Types"; "Compiler"];
6747+
lib_modules = ["Gcc_types"; "Gcc_compiler"];
67446748
lib_pack = false;
67456749
lib_internal_modules = [];
67466750
lib_findlib_parent = None;
@@ -6758,7 +6762,11 @@ let setup_t =
67586762
bs_install = [(OASISExpr.EBool true, true)];
67596763
bs_path = "bin_src";
67606764
bs_compiled_object = Best;
6761-
bs_build_depends = [InternalLibrary "llama_man"];
6765+
bs_build_depends =
6766+
[
6767+
InternalLibrary "llama_man";
6768+
FindlibPackage ("sexplib", None)
6769+
];
67626770
bs_build_tools = [ExternalTool "ocamlbuild"];
67636771
bs_c_sources = [];
67646772
bs_data_files = [];
@@ -6769,7 +6777,7 @@ let setup_t =
67696777
bs_byteopt = [(OASISExpr.EBool true, [])];
67706778
bs_nativeopt = [(OASISExpr.EBool true, [])]
67716779
},
6772-
{exec_custom = false; exec_main_is = "main.ml"});
6780+
{exec_custom = false; exec_main_is = "gcc.ml"});
67736781
Executable
67746782
({
67756783
cs_name = "test_runner";
@@ -6812,14 +6820,14 @@ let setup_t =
68126820
};
68136821
oasis_fn = Some "_oasis";
68146822
oasis_version = "0.4.4";
6815-
oasis_digest = Some "c\bb® ìBâ6Ô\023\028\140}èX";
6823+
oasis_digest = Some "­¼&¥²\006òW\142\015HùC¾i{";
68166824
oasis_exec = None;
68176825
oasis_setup_args = [];
68186826
setup_update = false
68196827
};;
68206828

68216829
let setup () = BaseSetup.setup setup_t;;
68226830

6823-
# 6824 "setup.ml"
6831+
# 6832 "setup.ml"
68246832
(* OASIS_STOP *)
68256833
let () = setup ();;

0 commit comments

Comments
 (0)