Skip to content

Commit 690bde3

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

File tree

13 files changed

+74
-62
lines changed

13 files changed

+74
-62
lines changed

_oasis

Lines changed: 9 additions & 6 deletions
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

Lines changed: 25 additions & 7 deletions
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

Lines changed: 9 additions & 0 deletions
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

Lines changed: 0 additions & 16 deletions
This file was deleted.

lib_src/META

Lines changed: 2 additions & 2 deletions
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

Lines changed: 0 additions & 5 deletions
This file was deleted.

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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 3 additions & 3 deletions
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

0 commit comments

Comments
 (0)