No description
- Rust 55.6%
- C 40.4%
- C++ 1.9%
- JavaScript 1.2%
- Tree-sitter Query 0.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| echo | ||
| editors/zed | ||
| examples | ||
| lumen | ||
| lumen-lsp | ||
| tree-sitter-lumen | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| ECHO.md | ||
| README.md | ||
| SPEC.md | ||
Lumen
Lumen is a compiled, statically checked language by Nytrix Labs. It compiles to Echo, a bytecode language that runs on its own VM. Both are written in Rust.
SPEC.md: the Lumen language (draft). §15 lists the choices the implementation made where the spec is undecided.ECHO.md: the Echo bytecode format and VM.
Build
cargo build --release
cargo install --path lumen && cargo install --path echo # optional: put them on your PATH
This builds three commands in target/release/: lumen, echovm and lumen-lsp. The VM isn't called echo because that name is a shell builtin. lumen-lsp is a language server for editors. editors/zed/ is a Zed extension that uses it (see its README).
Use
A project is a folder with a project file in it:
mkdir hello && cd hello
lumen init # makes hello.lmnproj and main.lmn
lumen run # compiles and runs main.lmn
lumen build # writes hello.echo
Files in the project drag each other by the project's name: drag .decdk from hello in main.lmn loads decdk.lmn, and its functions and types are then used as decdk.greet[…].
Single files work without a project too:
lumen examples/spec13.lmn # compile and run
lumen build examples/spec13.lmn # write examples/spec13.echo
lumen asm examples/spec13.lmn # show the compiled Echo as text
lumen check examples/spec13.lmn # errors and warnings only
lumen fmt # tidy indentation and blank lines in every .lmn of the project
lumen fmt --check examples/*.lmn # list files that aren't formatted (exit 1), changing nothing
echovm examples/spec13.echo # run compiled bytecode
echovm disasm examples/spec13.echo # bytecode → .echoasm text
echovm asm prog.echoasm -o prog.echo # .echoasm text → bytecode
Layout
| Path | What |
|---|---|
echo/src/module.rs |
Echo modules and the .echo binary format |
echo/src/opcode.rs |
the instruction set |
echo/src/vm.rs |
the VM, Group methods, natives (stdout, stdin) |
echo/src/asm.rs |
.echoasm assembler and disassembler |
lumen/src/lexer.rs, parser.rs, ast.rs |
Lumen source to syntax tree |
lumen/src/compiler.rs |
type checking and Echo code generation, plus the built-ins push and pull |
lumen/src/format.rs |
the formatter behind lumen fmt and the LSP's "format document" |
lumen/src/project.rs |
project files, lumen init, and loading dragged files |
lumen/tests/programs.rs, projects.rs |
end-to-end tests |
lumen-lsp/ |
the language server: diagnostics from the compiler, quick fixes, completion, hover |
tree-sitter-lumen/ |
a tree-sitter grammar, for highlighting |
editors/zed/ |
the Zed extension |
examples/ |
example programs, each with its expected output in a .out file |
Test
cargo test