mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-05 22:38:44 +00:00
Minor polishing
Signed-off-by: Kakadu <Kakadu@pm.me>
This commit is contained in:
parent
39fa6c2be9
commit
0ccc1c6e7d
9 changed files with 42 additions and 50 deletions
|
|
@ -1,6 +1,7 @@
|
|||
# This file is generated by dune, edit dune-project instead
|
||||
opam-version: "2.0"
|
||||
synopsis: "TODO"
|
||||
synopsis:
|
||||
"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."
|
||||
depends: [
|
||||
"dune" {>= "3.3"}
|
||||
"posix-uname"
|
||||
|
|
|
|||
52
Makefile
52
Makefile
|
|
@ -1,48 +1,42 @@
|
|||
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
|
||||
|
||||
all:
|
||||
$(MAKE) -C src
|
||||
$(MAKE) -C runtime
|
||||
$(MAKE) -C stdlib
|
||||
|
||||
STD_FILES=$(shell ls stdlib/*.[oi] stdlib/*.lama runtime/runtime.a runtime/Std.i)
|
||||
all: dune test regression
|
||||
|
||||
build: all
|
||||
mkdir -p $(BUILDDIR)
|
||||
cp -r runtime/Std.i runtime/runtime.a stdlib/* src/lamac $(BUILDDIR)
|
||||
build: dune b regression
|
||||
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
# Lama
|
||||
|
||||
 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.
|
||||
 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,
|
||||
|
|
@ -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
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
(package
|
||||
(name Lama)
|
||||
(allow_empty)
|
||||
(synopsis "TODO")
|
||||
(synopsis
|
||||
"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.")
|
||||
(depends
|
||||
posix-uname
|
||||
GT
|
||||
|
|
|
|||
1
src/.ocamlformat-ignore
Normal file
1
src/.ocamlformat-ignore
Normal file
|
|
@ -0,0 +1 @@
|
|||
X86_32.ml
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
open GT
|
||||
open Language
|
||||
open SM
|
||||
|
||||
(* X86 codegeneration interface *)
|
||||
|
||||
|
|
@ -241,7 +240,7 @@ let compile cmd env imports code =
|
|||
match instr with
|
||||
| PUBLIC name -> env#register_public name, []
|
||||
| EXTERN name -> env#register_extern name, []
|
||||
| IMPORT name -> env, []
|
||||
| IMPORT _name -> env, []
|
||||
|
||||
| CLOSURE (name, closure) ->
|
||||
let pushr, popr =
|
||||
|
|
@ -691,7 +690,7 @@ class env prg =
|
|||
|
||||
(* tag hash: gets a hash for a string tag *)
|
||||
method hash tag =
|
||||
let h = Pervasives.ref 0 in
|
||||
let h = Stdlib.ref 0 in
|
||||
for i = 0 to min (String.length tag - 1) 4 do
|
||||
h := (!h lsl 6) lor (String.index chars tag.[i])
|
||||
done;
|
||||
|
|
|
|||
6
src/dune
6
src/dune
|
|
@ -76,11 +76,9 @@
|
|||
|
||||
(executable
|
||||
(name Driver)
|
||||
(public_name lamac)
|
||||
(flags
|
||||
(:standard
|
||||
-rectypes
|
||||
;-dsource
|
||||
))
|
||||
(:standard -rectypes))
|
||||
(modules Driver)
|
||||
(libraries liba unix))
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
../Timer.lama
|
||||
%{project_root}/src/Driver.exe)
|
||||
(targets
|
||||
List.i
|
||||
List.o
|
||||
Array.i
|
||||
Array.o
|
||||
Buffer.i
|
||||
Buffer.o
|
||||
Collection.i
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
(deps
|
||||
../Makefile
|
||||
../../runtime/Std.i
|
||||
../List.lama
|
||||
../Array.lama
|
||||
../Buffer.lama
|
||||
../Collection.lama
|
||||
|
|
@ -18,8 +17,8 @@
|
|||
../Timer.lama
|
||||
%{project_root}/src/Driver.exe)
|
||||
(targets
|
||||
List.i
|
||||
List.o
|
||||
Array.i
|
||||
Array.o
|
||||
Buffer.i
|
||||
Buffer.o
|
||||
Collection.i
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue