Tox
Tox is a statically typed version programming language that is written in rust.
Install / Use
/learn @Lapz/ToxREADME
Tox
<br />
This is the new experimental version of Tox.I've been working on this slowly but I do have a working lexer plus parser and I've started on semantic analysis.
It's built using salsa and rowan and codespan. The design is inspired by rust-analyzer along with other projects.
Example Program
fn fib(n:int) -> int {
if (n < 2)
return n;
return fib(n - 2) + fib(n - 1);
}
A simple example that makes of uses of the classes
class Toggle {
state:bool;
fn value() -> bool {
return this.state;
}
fn activate() -> Toggle {
this.state = !this.state;
return this;
}
}
fn main() {
var toggle = Toggle{state:true};
print toggle.activate().value();
print toggle.activate().value();
}
Screenshots
<img src='./assets/program.png' width=250> <img src='./assets/errors.png' width=250> <img src='./assets/bar.png' width=250>TODO
- [x] Error when type is defined multiple times
- [x] Add resolve imports to ctx
- [x] Error when a function is used as a type
- [x] Error on duplicate pattern bindings in the same statement
- [x] Warn on unused pattern variable
- [x] Lower structural and struct methods
- [x] Lower enums
- [x] Resolve enums
- [x] Resolve external imports
- [x] Lower field access
- [x] Resolve class field access
- [x] Lower class literal
- [x] Resolve class literal
- [x] Infer types
- [] Codegen
- [] Finish of the VM
- [] Add support for closures
Build
Generate the ast
cargo run -p=tools -- -s -g=syntax/src/grammer.ron -t=syntax/src/ast.rs.tera
Resources
- rust
- plank
- lox
- menhir-lang
- minicom
- tiger-rs
- Kaleidoscope
- kaleidoscope-rs
- inko
- NovaLang
- gluon
- dora
- Modern Compiler Implementation in ML, java and C
- Developing Statically Typed Programming Language
- /r/ProgrammingLanguages
- awesome-compilers
Related Skills
himalaya
347.9kCLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
node-connect
347.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
taskflow
347.9kname: taskflow description: Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layer
frontend-design
108.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
