An open API service indexing awesome lists of open source software.

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

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`