mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-05 19:00:31 -05:00
examples/id_sexp (parser then prints S-expressions)
This commit is contained in:
parent
8bb6440344
commit
dcf134b1eb
5 changed files with 7840 additions and 26 deletions
4
Makefile
4
Makefile
|
|
@ -1,5 +1,5 @@
|
|||
# OASIS_START
|
||||
# DO NOT EDIT (digest: 9a60866e2fa295c5e33a3fe33b8f3a32)
|
||||
# DO NOT EDIT (digest: 46f8bd9984975bd4727bed22d0876cd2)
|
||||
|
||||
SETUP = ./setup.exe
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ configure: $(SETUP)
|
|||
$(SETUP) -configure $(CONFIGUREFLAGS)
|
||||
|
||||
setup.exe: setup.ml
|
||||
ocamlfind ocamlopt -o $@ -linkpkg -package oasis.dynrun $< || ocamlfind ocamlc -o $@ -linkpkg -package oasis.dynrun $< || true
|
||||
ocamlfind ocamlopt -o $@ $< || ocamlfind ocamlc -o $@ $< || true
|
||||
$(RM) setup.cmi setup.cmo setup.cmx setup.o
|
||||
|
||||
.PHONY: build doc test all install uninstall reinstall clean distclean configure
|
||||
|
|
|
|||
8
_oasis
8
_oasis
|
|
@ -219,6 +219,14 @@ Executable lambda
|
|||
Build$: flag(misc)
|
||||
BuildDepends: containers,containers.misc
|
||||
|
||||
Executable id_sexp
|
||||
Path: examples/
|
||||
Install: false
|
||||
CompiledObject: native
|
||||
MainIs: id_sexp.ml
|
||||
Build$: flag(misc)
|
||||
BuildDepends: containers,containers.misc
|
||||
|
||||
SourceRepository head
|
||||
Type: git
|
||||
Location: https://github.com/c-cube/ocaml-containers
|
||||
|
|
|
|||
9
_tags
9
_tags
|
|
@ -1,5 +1,5 @@
|
|||
# OASIS_START
|
||||
# DO NOT EDIT (digest: fbebfae7c483734f1144067d9ae9954b)
|
||||
# DO NOT EDIT (digest: c9667e55919ea370f2e3a33376a7eec4)
|
||||
# Ignore VCS directories, you can use the same kind of rule outside
|
||||
# OASIS_START/STOP if you want to exclude directories that contains
|
||||
# useless stuff for the build process
|
||||
|
|
@ -19,6 +19,9 @@
|
|||
"string/containers_string.cmxs": use_containers_string
|
||||
"string/KMP.cmx": for-pack(Containers_string)
|
||||
"string/levenshtein.cmx": for-pack(Containers_string)
|
||||
# Library containers_pervasives
|
||||
"pervasives/containers_pervasives.cmxs": use_containers_pervasives
|
||||
<pervasives/*.ml{,i}>: use_containers
|
||||
# Library containers_misc
|
||||
"misc/containers_misc.cmxs": use_containers_misc
|
||||
"misc/cache.cmx": for-pack(Containers_misc)
|
||||
|
|
@ -146,6 +149,10 @@
|
|||
"examples/lambda.byte": package(unix)
|
||||
"examples/lambda.byte": use_containers
|
||||
"examples/lambda.byte": use_containers_misc
|
||||
# Executable id_sexp
|
||||
"examples/id_sexp.native": package(unix)
|
||||
"examples/id_sexp.native": use_containers
|
||||
"examples/id_sexp.native": use_containers_misc
|
||||
<examples/*.ml{,i}>: package(unix)
|
||||
<examples/*.ml{,i}>: use_containers
|
||||
<examples/*.ml{,i}>: use_containers_misc
|
||||
|
|
|
|||
13
examples/id_sexp.ml
Normal file
13
examples/id_sexp.ml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
|
||||
let () =
|
||||
if Array.length Sys.argv <> 2 then failwith "usage: id_sexp file";
|
||||
let f = Sys.argv.(1) in
|
||||
let s = Sexp.parse_l_file f in
|
||||
match s with
|
||||
| `Ok l ->
|
||||
List.iter
|
||||
(fun s -> Format.printf "@[%a@]@." Sexp.print s)
|
||||
l
|
||||
| `Error msg ->
|
||||
Format.printf "error: %s@." msg
|
||||
Loading…
Add table
Reference in a new issue