https://github.com/kvbc/rylang
A programming language in progress
https://github.com/kvbc/rylang
Last synced: 12 months ago
JSON representation
A programming language in progress
- Host: GitHub
- URL: https://github.com/kvbc/rylang
- Owner: kvbc
- Created: 2023-05-21T18:31:59.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-10T16:03:05.000Z (over 2 years ago)
- Last Synced: 2025-08-09T01:53:30.899Z (12 months ago)
- Language: C++
- Homepage:
- Size: 11.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rylang
A programming language in progress, which this repository will host the compiler of.
See [docs/spec.md](docs/spec.md)
For ease of reading the Markdown files, I recommend opening them up in VSCode
# TODO
- Link to external Markdown reader, for example: https://dillinger.io/ (this one doesn't work with custom heading ids)
- Better error messages and handling
- Perhaps separate all stringify functions in `ASTNode` into its own `Stringifier` class
# Compiler
```mermaid
graph TD
Lexer --> |Tokens| Parser
Parser --> |Untyped AST| Analyzer
Analyzer --> |Untyped AST| Typer
Typer --> |Typed AST| CTEE[Compile-time expression evaluator - CTEE]
subgraph Frontend
Lexer & Parser & Analyzer & Typer
end
CTEE ---> |Unmodified Typed AST| Transpiler
CTEE .-> |Modified Typed AST| Transpiler
Transpiler --> C[C code]
C --> CComp[C Compiler]
C .-> JIT[C JIT]
JIT .-> |evaluations| CTEE
CTEE <.-> |?| Macro[Macro Processor ?]
subgraph Third-party
JIT & CComp
end
subgraph Backend
Macro & CTEE & Transpiler
end
CComp --> EXE[Final Executable]
```
# Overview
```rust
Vector2 := $[
x, y #i32;
add[self *#Vector2, other *Vector2] => [] = {
self.x += other.x;
self.y += other.y;
}
]
main[] => [] = {
pos Vector2 = [1, 2];
ofs Vector2 = [3, 4];
pos.add[&ofs];
}
```
# Installing
1. Get meson with `pip3 install meson`
2. Get [ninja](https://github.com/ninja-build/ninja/releases)
3. Run `setup.bat`
# Building
Run `build.bat`
# Running
Run `run.bat`