mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-14 17:35:03 +01:00
start bird
This commit is contained in:
parent
0b79d4500d
commit
68a91a7b44
5 changed files with 41 additions and 0 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
There is currently a tree-walking interpreter called `bird` in progress, but the plan is to have a bytecode vm in the end
|
||||||
|
|
||||||
language_name is a small embeddable scripting language
|
language_name is a small embeddable scripting language
|
||||||
|
|
||||||
language_name is inspired by Javascript, Lox, Lua, Python, Rust and more
|
language_name is inspired by Javascript, Lox, Lua, Python, Rust and more
|
||||||
|
|
|
||||||
12
src/bird/mem.rs
Normal file
12
src/bird/mem.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Clone, Hash)]
|
||||||
|
enum Value {
|
||||||
|
Null,
|
||||||
|
Bool(bool),
|
||||||
|
Number(f64),
|
||||||
|
String(String),
|
||||||
|
Object(HashMap<String, Value>),
|
||||||
|
Array(Vec<Value>),
|
||||||
|
}
|
||||||
8
src/bird/mod.rs
Normal file
8
src/bird/mod.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
mod mem;
|
||||||
|
|
||||||
|
use crate::ast::Program;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
struct Vm {}
|
||||||
|
|
||||||
|
fn execute(program: Program) {}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
mod ast;
|
mod ast;
|
||||||
|
mod bird;
|
||||||
mod errors;
|
mod errors;
|
||||||
mod lex;
|
mod lex;
|
||||||
mod parse;
|
mod parse;
|
||||||
|
|
|
||||||
18
std.md
Normal file
18
std.md
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Std functions
|
||||||
|
|
||||||
|
`x`, `y`, .. : arguments
|
||||||
|
`x?` : optional
|
||||||
|
`x(): int` : return type
|
||||||
|
|
||||||
|
Available on the global scope for now:
|
||||||
|
|
||||||
|
# IO
|
||||||
|
|
||||||
|
`print(x)`
|
||||||
|
|
||||||
|
`println(x)`
|
||||||
|
|
||||||
|
`input(x?): string`
|
||||||
|
|
||||||
|
`time(): number`
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue