Skip to content
This repository has been archived by the owner on Dec 28, 2022. It is now read-only.

Commit

Permalink
use jbuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
rvantonder committed Oct 25, 2017
1 parent b94d1b0 commit aa9a3e2
Show file tree
Hide file tree
Showing 21 changed files with 53 additions and 7,845 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
*.native
_build
/setup.data
/setup.log
/setup.log
.merlin
smtlib.install
44 changes: 11 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,41 +1,19 @@
# OASIS_START
# DO NOT EDIT (digest: a3c674b4239234cbbe53afe090018954)

SETUP = ocaml setup.ml

build: setup.data
$(SETUP) -build $(BUILDFLAGS)

doc: setup.data build
$(SETUP) -doc $(DOCFLAGS)

test: setup.data build
$(SETUP) -test $(TESTFLAGS)

all:
$(SETUP) -all $(ALLFLAGS)
@jbuilder build @install @DEFAULT

install: setup.data
$(SETUP) -install $(INSTALLFLAGS)
install:
@jbuilder install

uninstall: setup.data
$(SETUP) -uninstall $(UNINSTALLFLAGS)
doc:
@jbuilder build @doc

reinstall: setup.data
$(SETUP) -reinstall $(REINSTALLFLAGS)
test:
@jbuilder runtest

clean:
$(SETUP) -clean $(CLEANFLAGS)

distclean:
$(SETUP) -distclean $(DISTCLEANFLAGS)

setup.data:
$(SETUP) -configure $(CONFIGUREFLAGS)

configure:
$(SETUP) -configure $(CONFIGUREFLAGS)
@jbuilder clean

.PHONY: build doc test all install uninstall reinstall clean distclean configure
uninstall:
@jbuilder uninstall

# OASIS_STOP
.PHONY: all install test clean uninstall
33 changes: 0 additions & 33 deletions README.md

This file was deleted.

30 changes: 0 additions & 30 deletions _oasis

This file was deleted.

21 changes: 0 additions & 21 deletions _tags

This file was deleted.

27 changes: 0 additions & 27 deletions configure

This file was deleted.

12 changes: 0 additions & 12 deletions lib/META

This file was deleted.

9 changes: 7 additions & 2 deletions lib/Smtlib.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
open Sexplib.Std

include Smtlib_syntax
include Syntax

type solver = { stdin : out_channel; stdout : in_channel; stdout_lexbuf : Lexing.lexbuf }

Expand Down Expand Up @@ -35,7 +35,7 @@ let write (solver : solver) (e : sexp) : unit =
flush solver.stdin

let read (solver : solver) : sexp =
Smtlib_parser.sexp Smtlib_lexer.token solver.stdout_lexbuf
Parser.sexp Lexer.token solver.stdout_lexbuf

let command (solver : solver) (sexp : sexp) = write solver sexp; read solver

Expand Down Expand Up @@ -248,6 +248,11 @@ let maximize (solver : solver) (term : term) : unit =
let minimize (solver : solver) (term : term) : unit =
silent_command solver (SList ([SSymbol "minimize"; term_to_sexp term]))

let read_objectives (solver : solver) : unit =
match read solver with
| SList [SSymbol "objectives"; SList l] -> ()
| s -> failwith ("unexpected result in optimized objective, got " ^ sexp_to_string s)

let rec check_sat (solver : solver) : check_sat_result =
let fail sexp = failwith ("unexpected result from (check-sat), got " ^
sexp_to_string sexp) in
Expand Down
5 changes: 4 additions & 1 deletion lib/Smtlib.mli
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ val maximize : solver -> term -> unit
(** [minimize solver e] runs the command [(minimize e)] *)
val minimize : solver -> term -> unit

(** [read_objectives solver] reads output of objective function printed after calls to [check_sat solver] *)
val read_objectives : solver -> unit

(** [check_sat solver] runs the command [(check-sat)] *)
val check_sat : solver -> check_sat_result

Expand Down Expand Up @@ -194,7 +197,7 @@ val bvnot : term -> term
(** {1 Low-level interface} *)

(** The variant of s-expressions used by SMT-LIB. *)
type sexp = Smtlib_syntax.sexp =
type sexp = Syntax.sexp =
| SList of sexp list
| SSymbol of string
| SString of string
Expand Down
4 changes: 0 additions & 4 deletions lib/doc.odocl

This file was deleted.

12 changes: 12 additions & 0 deletions lib/jbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(jbuild_version 1)

(ocamllex
(lexer))

(menhir
((modules (parser))))

(library
((name smtlib)
(public_name smtlib)
(libraries (menhirLib ppx_deriving ppx_jane))))
2 changes: 1 addition & 1 deletion lib/Smtlib_lexer.mll → lib/lexer.mll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
open Lexing
open Smtlib_parser
open Parser

let parse_hex (str : string) : (int * int) =
let len = (String.length str) - 2 in
Expand Down
4 changes: 2 additions & 2 deletions lib/Smtlib_parser.mly → lib/parser.mly
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%{
open Smtlib_syntax
open Syntax
%}

%token LPAREN RPAREN
Expand All @@ -11,7 +11,7 @@ open Smtlib_syntax
%token EOF

%start sexp
%type <Smtlib_syntax.sexp> sexp
%type <Syntax.sexp> sexp

%%

Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 0 additions & 7 deletions lib/z3.mldylib

This file was deleted.

7 changes: 0 additions & 7 deletions lib/z3.mllib

This file was deleted.

Loading

0 comments on commit aa9a3e2

Please sign in to comment.