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" opam-version: "2.0"
version: "1.30" 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"
synopsis: "Lama programming language" maintainer: ["http://github.com/Kakadu"]
maintainer: "dboulytchev@gmail.com" authors: ["http://github.com/dboulytchev" "http://github.com/danyaberezun"]
authors: [ license: "GPL-3.0-only"
"Dmitry Boulytchev <dboulytchev@gmail.com>"
"Daniil Berezun <danya.berezun@gmail.com>"
"Egor Sheremetov <egor.sheremetov.dev@gmail.com>"
]
homepage: "https://github.com/PLTools/Lama" homepage: "https://github.com/PLTools/Lama"
bug-reports: "https://github.com/PLTools/Lama/issues" bug-reports: "https://github.com/PLTools/Lama/issues"
depends: [ depends: [
"ocaml" { >= "4.13.1" } "dune" {>= "3.3"}
"ocamlfind" { build } "posix-uname"
"camlp5" { >= "8.00.05" } "GT"
"ostap" { >= "0.5"} "ostap" {>= "0.6"}
"GT" { >= "0.5.1" } "odoc" {with-doc}
"posix-uname" { = "2.0.2" }
] ]
build: [ build: [
[make] ["dune" "subst"] {dev}
[make "regression"] {with-test} [
"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 INSTALL ?= install -v
MKDIR ?= mkdir MKDIR ?= mkdir
BUILDDIR = build BUILDDIR = _build
.PHONY: all regression .DEFAULT_GOAL := build
all: all: build test
$(MAKE) -C src
$(MAKE) -C runtime
$(MAKE) -C stdlib
STD_FILES=$(shell ls stdlib/*.[oi] stdlib/*.lama runtime/runtime.a runtime/Std.i) build:
dune b src runtime runtime32 stdlib tutorial
build: all
mkdir -p $(BUILDDIR)
cp -r runtime/Std.i runtime/runtime.a stdlib/* src/lamac $(BUILDDIR)
install: all install: all
$(INSTALL) $(EXECUTABLE) `opam var bin` dune b @install --profile=release
$(MKDIR) -p `opam var share`/Lama dune install --profile=release
$(INSTALL) $(STD_FILES) `opam var share`/Lama/ $(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: uninstall:
$(RM) -r `opam var share`/Lama $(RM) -r `opam var share`/Lama
$(RM) `opam var bin`/$(EXECUTABLE) dune uninstall
regression-all: regression regression-expressions regression-all: regression regression-expressions
test: regression
regression: regression:
$(MAKE) clean check -j8 -C regression dune test regression
$(MAKE) clean check -j8 -C stdlib/regression
regression-expressions: regression-expressions:
$(MAKE) clean check -j8 -C regression/expressions dune test regression_long
$(MAKE) clean check -j8 -C regression/deep-expressions
negative_scenarios_tests:
$(MAKE) -C runtime negative_tests
clean: clean:
$(MAKE) clean -C src @dune clean
$(MAKE) clean -C runtime
$(MAKE) clean -C stdlib
$(MAKE) clean -C regression
$(MAKE) clean -C byterun
$(MAKE) clean -C bench
rm -rf $(BUILDDIR)

View file

@ -7,7 +7,7 @@
# Lama # 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: Its general characteristics are:
* procedural with first-class functions - functions can be passed as arguments, placed in data structures, * procedural with first-class functions - functions can be passed as arguments, placed in data structures,
@ -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 1. Install the right [switch](https://opam.ocaml.org/doc/Manual.html#Switches) for the OCaml compiler
```bash ```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: * In the above command:
- `opam switch create` is a subcommand to create a new switch - `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 - `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`) 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 * 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 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) (lang dune 3.3)
(cram enable) (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