Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
gbdrt committed Jul 24, 2017
0 parents commit 5308364
Show file tree
Hide file tree
Showing 57 changed files with 2,975 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
include ./config

.PHONY: help install uninstall example

help:
@printf "Type 'make install' to install Zélus into:\n"
@printf " ${bindir}\n"
@printf " ${libdir}\n"
@printf "\n"
@printf "Type 'make example' to build the example.\n"

install:
mkdir -p ${bindir}
cp bin/zeluc.byte ${bindir}/
cp bin/zeluc ${bindir}/
mkdir -p ${libdir}
cp lib/* ${libdir}/
$(OCAMLFIND) install zelus META || true

uninstall:
rm -f ${bindir}/zeluc.byte
rm -f ${bindir}/zeluc
rm -rf ${libdir}
$(OCAMLFIND) remove zelus || true

example:
${MAKE} -C example

42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# ZSy: A Synchronous Language with Timers

This distribution includes the Zélus compiler extended to compile ZSy
programs, runtime libraries, and example source code. The OCaml
runtime (ocamlrun) is required to transform ZSy programs into
imperative code. The OCaml compiler is required to compile imperative
code into executables.

## Dependencies

| Dependency | Version | Reason |
|------------|---------|--------|
| [OCaml](http://ocaml.org/) | Required == 4.04.0 | Run the Zélus compiler and compile the examples |
| [XQuartz](http://www.xquartz.org/) | Optional >= 2.7.9 | Required on MacOS to run the examples using OCaml Graphics |


## Installing the compiler

Run the configure script (optionally setting an installation prefix):

```
./configure --prefix=/usr/local
```

Zélus can then be installed by running:

```
sudo make install
```

There is an option `-symb <main_node>` to compile ZSy programs.
An example of a ZSy program is given in `example`.

## Example

An example of a ZSy program simulating a simple two-node architecture
can be found in `example/qpa.zls`. To build and run the example run:

```
make example
./example/qpa.byte
```
4 changes: 4 additions & 0 deletions bin/zeluc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
ZLLIB=/usr/local/lib/zelus
export ZLLIB
exec ocamlrun /usr/local/bin/zeluc.byte $@
Binary file added bin/zeluc.byte
Binary file not shown.
153 changes: 153 additions & 0 deletions config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@

VERSION = @VERSION@

# configure variables
bindir = @bindir@
libdir = @libdir@/zelus

# options
gtktargets = @gtktargets@
targets = @targets@

# programs used

OCAML ?= @OCAMLBIN@ocaml
OCAMLC ?= @OCAMLBIN@ocamlc
OCAMLLEX ?= @OCAMLBIN@ocamllex
OCAMLYACC ?= @OCAMLBIN@ocamlyacc
OCAMLOPT ?= @OCAMLBIN@ocamlopt
OCAMLDEP ?= @OCAMLBIN@ocamldep
OCAMLRUN ?= @OCAMLBIN@ocamlrun
OCAMLFIND ?= @OCAMLFIND@
MENHIR ?= @OCAMLBIN@menhir
OTAGS ?= otags

ZLLIB = ../lib
TOOLS = ../tools

OCAMLFLAGS ?= -annot -w -3-26
OCAMLOPTFLAGS ?= -annot -w -3-26
CPPFLAGS ?= -P -x c

BIN = zeluc
TARGET ?= $(word 1, $(targets))

ifeq (@for_compile@,1)
ZELUC := ../bin/$(BIN)
else
ZELUC := ../bin/$(BIN).$(TARGET) -stdlib ../lib
endif

UNIX = unix.cma
UNIXX = unix.cmxa

GLMLITE_ENABLED = @GLMLITE_ENABLED@
GLMLITE = -I @GLMLITE_INCL@

LABLGTK2 = -I @LABLGTK2_PATH@

MENHIRLIB = @MENHIRLIB@
MENHIRFLAGS = --table

MATLAB = @MATLAB@
MATLABFLAGS = -nodesktop -nosplash

PTOLEMY = @PTOLEMY@
PTOLEMYFLAGS =

SOLVER = @DEFAULT_SOLVER@

SUNDIALS=@SUNDIALSML_INCL@
ifneq ($(SUNDIALS),)
SUNDIALS_CVODE = sundials.cma
OPTIONAL_SOLVER_OBJS = solvers/sundials_cvode.cmo
DISTOPTION = -sundials
else
DISTOPTION = -nosundials
endif

ZLSTDLIBS = bigarray.cma unix.cma $(SUNDIALS) $(SUNDIALS_CVODE)
ZLEXTRALIBS = zllib.cma
ZLGTKLIBS = $(LABLGTK2) lablgtk.cma zllibgtk.cma

DIRECTORIES = global parsing typing analysis rewrite gencode verif main

# colours (used in tests)

ifdef NOCOLOR
S_BLUE = ""
S_GREEN = ""
S_RED = ""
S_NORMAL = ""
else
S_BLUE = "\\033[34m"
S_GREEN = "\\033[32m"
S_RED = "\\033[31m"
S_NORMAL = "\\033[0m"
endif

# debugger commands

define DEBUG_PRELUDE
directory $(DIRECTORIES)

load_printer "debugprinter.cma"
install_printer Ident.fprint_t
install_printer Ident.Env.fprint_3ident
install_printer Ident.S.fprint_t
install_printer Lident.fprint_t
install_printer Ptypes.output
install_printer Printer.expression
install_printer Printer.equation
install_printer Printer.print_env
install_printer Printer.implementation
install_printer Printer.interface
install_printer Printer.state_ident_typ
install_printer Printer.state_eq
install_printer Printer.local
install_printer Oprinter.implementation
install_printer Oprinter.ptype
install_printer Oprinter.pattern
install_printer Oprinter.expression
install_printer Causal.Cenv.penv
install_printer Causal.Cenv.pcaus
install_printer Causal.Cenv.ptype
install_printer Deadcode.print

endef
export DEBUG_PRELUDE

# implicit rules

.SUFFIXES : .mli .ml .cmi .cmo .cmx .mll .mly .zli .zli .byte .opt

%.cmi: %.mli
$(OCAMLC) $(OCAMLFLAGS) -c $(INCLUDES) $<

%.cmo %.cmi: %.ml
$(OCAMLC) $(OCAMLFLAGS) -c -I $(ZLLIB) $(INCLUDES) $<

%.cmx %.cmi: %.ml
$(OCAMLOPT) $(OCAMLOPTFLAGS) -I $(ZLLIB) -c $(INCLUDES:.cma=.cmxa) $<

%.zci: %.zli
$(ZELUC) $(ZELUCFLAGS) $<

%.ml: %.mll
$(OCAMLLEX) $<

%.ml %.mli: %.mly
$(MENHIR) $(MENHIRFLAGS) $<

# set ZLEXTRALIBS to ZLGTKLIBS to compile examples that use gtk
%.byte: %.ml
$(OCAMLC) $(OCAMLFLAGS) -o $@ $(INCLUDES) \
-I $(ZLLIB) $(ZLSTDLIBS) $(ZLEXTRALIBS) \
$< $(<:.ml=_main.ml)

# set ZLEXTRALIBS to ZLGTKLIBS to compile examples that use gtk
%.opt: %.ml
$(OCAMLOPT) $(OCAMLOPTFLAGS) -o $@ $(INCLUDES) \
-I $(ZLLIB) $(ZLSTDLIBS:.cma=.cmxa) $(ZLEXTRALIBS:.cma=.cmxa) \
$< $(<:.ml=_main.ml)

17 changes: 17 additions & 0 deletions config.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

Configuration
-------------

OCaml /usr/local/lib/ocaml (4.04.0)
Lablgtk2 /Users/baudart/.opam/4.04.0/lib/lablgtk2
SundialsML /usr/local/lib/ocaml/sundialsml
glMLite NOT WORKING (/Users/baudart/.opam/4.04.0/lib/glMLite; 3D demos disabled)

targets: byte opt withgtk.byte withgtk.opt

Installation paths
prefix: /usr/local
bindir: /usr/local/bin
libdir: /usr/local/lib
mandir: /usr/local/share/man/

Loading

0 comments on commit 5308364

Please sign in to comment.