start bird

This commit is contained in:
nora 2021-11-03 21:17:32 +01:00
parent 0b79d4500d
commit 68a91a7b44
5 changed files with 41 additions and 0 deletions

View file

@ -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 inspired by Javascript, Lox, Lua, Python, Rust and more

12
src/bird/mem.rs Normal file
View 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
View file

@ -0,0 +1,8 @@
mod mem;
use crate::ast::Program;
#[derive(Debug)]
struct Vm {}
fn execute(program: Program) {}

View file

@ -1,4 +1,5 @@
mod ast;
mod bird;
mod errors;
mod lex;
mod parse;

18
std.md Normal file
View 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`