Merge pull request #28 from PLTools/more-dune

More dune
This commit is contained in:
Dmitry Boulytchev 2024-09-13 03:34:06 +03:00 committed by GitHub
commit d836301dd7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34331 changed files with 26915 additions and 12826 deletions

View file

@ -1,32 +1,30 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "1.30"
synopsis: "Lama programming language"
maintainer: "dboulytchev@gmail.com"
authors: [
"Dmitry Boulytchev <dboulytchev@gmail.com>"
"Daniil Berezun <danya.berezun@gmail.com>"
"Egor Sheremetov <egor.sheremetov.dev@gmail.com>"
]
homepage: "https://github.com/PLTools/Lama"
synopsis:
"A programming language (initially developed by JetBrains Research) for educational purposes as an exemplary language to introduce the domain of programming languages, compilers, and tools"
maintainer: ["http://github.com/Kakadu"]
authors: ["http://github.com/dboulytchev" "http://github.com/danyaberezun"]
license: "GPL-3.0-only"
homepage: "https://github.com/PLTools/Lama"
bug-reports: "https://github.com/PLTools/Lama/issues"
depends: [
"ocaml" { >= "4.13.1" }
"ocamlfind" { build }
"camlp5" { >= "8.00.05" }
"ostap" { >= "0.5"}
"GT" { >= "0.5.1" }
"posix-uname" { = "2.0.2" }
"dune" {>= "3.3"}
"posix-uname"
"GT"
"ostap" {>= "0.6"}
"odoc" {with-doc}
]
build: [
[make]
[make "regression"] {with-test}
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
install: [make "install"]
dev-repo: "git+https://github.com/PLTools/Lama.git"
url {
src: "git+https://github.com/PLTools/Lama.git#1.30"
}

View file

@ -1,48 +1,43 @@
EXECUTABLE = src/lamac
.PHONY: all regression
.PHONY: clean test regression regression-expressions regression-all uninstall install build
INSTALL ?= install -v
MKDIR ?= mkdir
BUILDDIR = build
BUILDDIR = _build
.PHONY: all regression
.DEFAULT_GOAL := build
all:
$(MAKE) -C src
$(MAKE) -C runtime
$(MAKE) -C stdlib
all: build test
STD_FILES=$(shell ls stdlib/*.[oi] stdlib/*.lama runtime/runtime.a runtime/Std.i)
build: all
mkdir -p $(BUILDDIR)
cp -r runtime/Std.i runtime/runtime.a stdlib/* src/lamac $(BUILDDIR)
build:
dune b src runtime runtime32 stdlib tutorial
install: all
$(INSTALL) $(EXECUTABLE) `opam var bin`
$(MKDIR) -p `opam var share`/Lama
$(INSTALL) $(STD_FILES) `opam var share`/Lama/
dune b @install --profile=release
dune install --profile=release
$(MKDIR) -p `opam var share`/Lama/x64
$(INSTALL) $(shell ls _build/default/stdlib/x64/*.[oi] _build/default/stdlib/x64/stdlib/*.lama \
runtime/runtime.a runtime/Std.i) \
`opam var share`/Lama/x64
$(MKDIR) -p `opam var share`/Lama/x32
$(INSTALL) $(shell ls _build/default/stdlib/x32/*.[oi] _build/default/stdlib/x32/stdlib/*.lama \
runtime32/runtime.a runtime32/Std.i) \
`opam var share`/Lama/x32
uninstall:
$(RM) -r `opam var share`/Lama
$(RM) `opam var bin`/$(EXECUTABLE)
dune uninstall
regression-all: regression regression-expressions
test: regression
regression:
$(MAKE) clean check -j8 -C regression
$(MAKE) clean check -j8 -C stdlib/regression
dune test regression
regression-expressions:
$(MAKE) clean check -j8 -C regression/expressions
$(MAKE) clean check -j8 -C regression/deep-expressions
negative_scenarios_tests:
$(MAKE) -C runtime negative_tests
dune test regression_long
clean:
$(MAKE) clean -C src
$(MAKE) clean -C runtime
$(MAKE) clean -C stdlib
$(MAKE) clean -C regression
$(MAKE) clean -C byterun
$(MAKE) clean -C bench
rm -rf $(BUILDDIR)
@dune clean

View file

@ -7,7 +7,7 @@
# Lama
![lama](lama.svg) is a programming language developed by JetBrains Research for educational purposes as an exemplary language to introduce the domain of programming languages, compilers, and tools.
![lama](lama.svg) is a programming language (initualy developed by JetBrains Research) for educational purposes as an exemplary language to introduce the domain of programming languages, compilers, and tools.
Its general characteristics are:
* procedural with first-class functions - functions can be passed as arguments, placed in data structures,
@ -52,8 +52,8 @@ Ubuntu-based variant of WSL is recommended.
sudo apt install gcc
```
- MacOS: `clang`
- MacOS: `clang`
Should be automatically installed with developer tools.
- [opam](http://opam.ocaml.org) (>= 2.0.4)
@ -67,13 +67,13 @@ Ubuntu-based variant of WSL is recommended.
1. Install the right [switch](https://opam.ocaml.org/doc/Manual.html#Switches) for the OCaml compiler
```bash
opam switch create lama --packages=ocaml-variants.4.14.0+options,ocaml-option-flambda
opam switch create lama --packages=ocaml-variants.4.14.2+options,ocaml-option-flambda
```
* In the above command:
- `opam switch create` is a subcommand to create a new switch
- `ocaml-variants.4.14.0+options` is the name of a standard template for the switch
- `ocaml-variants.4.14.2+options` is the name of a standard template for the switch
- `lama` is an alias for the switch being created; on success a directory `$(HOME)/.opam/lama` should be created
2. Update PATH variable for the fresh switch. (You can add these commands to your `~/.bashrc` for convenience but they should be added by `opam`)
@ -83,7 +83,7 @@ Ubuntu-based variant of WSL is recommended.
* Check that the OCaml compiler is now available in PATH by running `which ocamlc`; it should answer with `/home/user/.opam/lama/bin/ocamlc` (or similar) and `ocamlc -v` should answer with
```
The OCaml compiler, version 4.10.1
The OCaml compiler, version 4.14.2
Standard library directory: /home/user/.opam/lama/lib/ocaml
```

View file

@ -1,12 +0,0 @@
all: gc_runtime.o runtime.o
ar rc runtime.a gc_runtime.o runtime.o
gc_runtime.o: gc_runtime.s
$(CC) -g -fstack-protector-all -m32 -c gc_runtime.s
runtime.o: runtime.c
$(CC) -g -fstack-protector-all -m32 -c runtime.c
clean:
$(RM) *.a *.o *~

1
byterun/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/byterun.exe

View file

@ -1,10 +0,0 @@
FLAGS=-g -fstack-protector-all
all: byterun.o
$(CC) $(FLAGS) -o byterun byterun.o ../runtime/runtime.a
byterun.o: byterun.c
$(CC) $(FLAGS) -g -c byterun.c
clean:
$(RM) *.a *.o *~ byterun

9
byterun/dune Normal file
View file

@ -0,0 +1,9 @@
(rule
(target byterun.exe)
(deps
(:main byterun.c)
(:runtime ../runtime/runtime.a))
(mode
(promote (until-clean)))
(action
(run gcc -g %{main} %{runtime} -o %{target})))

View file

@ -1,3 +1,25 @@
(lang dune 3.3)
(cram enable)
(generate_opam_files true)
(bug_reports "https://github.com/PLTools/Lama/issues")
(homepage "https://github.com/PLTools/Lama")
(maintainers "http://github.com/Kakadu")
(authors "http://github.com/dboulytchev" "http://github.com/danyaberezun")
(license GPL-3.0-only)
(package
(name Lama)
(synopsis
"A programming language (initially developed by JetBrains Research) for educational purposes as an exemplary language to introduce the domain of programming languages, compilers, and tools")
(depends
posix-uname
GT
(ostap
(>= 0.6))))

1
performance/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/*.exe

View file

@ -1,14 +0,0 @@
TESTS=$(sort $(basename $(wildcard *.lama)))
LAMAC=../src/lamac
.PHONY: check $(TESTS)
check: $(TESTS)
$(TESTS): %: %.lama
@echo $@
LAMA=../runtime $(LAMAC) $< && `which time` -f "$@\t%U" ./$@
clean:
$(RM) test*.log *.s *~ $(TESTS) *.i

21
performance/dune Normal file
View file

@ -0,0 +1,21 @@
(rule
(targets Sort.x64.exe)
(deps
(:lama Sort.lama)
../runtime/runtime.a)
(mode
(promote (until-clean)))
(action
(setenv
LAMA
"../runtime"
(run
%{project_root}/src/Driver.exe
-march=x86_64
%{lama}
-I
../stdlib/x64
-I
../runtime
-o
%{targets}))))

View file

@ -1,24 +0,0 @@
DEBUG_FILES=stack-dump-before data-dump-before extra-roots-dump-before heap-dump-before stack-dump-after data-dump-after extra-roots-dump-after heap-dump-after
TESTS=$(sort $(filter-out test111, $(basename $(wildcard test*.lama))))
LAMAC=../src/lamac
.PHONY: check $(TESTS)
check: $(TESTS) ctest111
$(TESTS): %: %.lama
@echo "regression/$@"
@cat $@.input | LAMA=../runtime $(LAMAC) -i $< > $@.log && diff $@.log orig/$@.log
@cat $@.input | LAMA=../runtime $(LAMAC) -ds -s $< > $@.log && diff $@.log orig/$@.log
@LAMA=../runtime $(LAMAC) $< && cat $@.input | ./$@ > $@.log && diff $@.log orig/$@.log
ctest111:
@echo "regression/test111"
@LAMA=../runtime $(LAMAC) test111.lama && cat test111.input | $(ARCH) ./test111 > test111.log && diff test111.log orig/test111.log
clean:
$(RM) test*.log *.s *.sm *~ $(TESTS) *.i $(DEBUG_FILES) test111
$(MAKE) clean -C expressions
$(MAKE) clean -C deep-expressions

View file

@ -1,16 +0,0 @@
open GT
open Syntax
let conj = (&&)
open Embedding
let state ps = List.fold_right (fun (x, v) (s, p) -> Expr.update x v s, (x =:= !? v) :: p) ps (Expr.empty, [])
let eval (s, p) e =
let orig = Expr.eval s e in
let stmt = List.fold_right (fun p s -> p |> s) p (Stmt.Write e) in
let [s_orig] = eval [] stmt in
let [sm_orig] = SM.run [] (SM.compile stmt) in
if conj (orig = s_orig) (orig = sm_orig)
then Printf.printf "%d\n" orig
else Printf.printf "*** divergence: %d <?> %d <?> %d\n" orig s_orig sm_orig

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 0

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

View file

@ -1 +0,0 @@
> > > > 1

Some files were not shown because too many files have changed in this diff Show more