1
1
Fork 0
mirror of https://github.com/azur1s/bobbylisp.git synced 2024-10-16 02:37:40 -05:00

very bumpy

This commit is contained in:
Natapat Samutpong 2022-03-23 08:18:37 +07:00
parent b52661c9d9
commit 070b8b259c
3 changed files with 12 additions and 12 deletions

2
Cargo.lock generated
View file

@ -152,7 +152,7 @@ checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]] [[package]]
name = "hazure" name = "hazure"
version = "0.1.0" version = "0.1.1"
dependencies = [ dependencies = [
"clap", "clap",
"codegen", "codegen",

View file

@ -27,6 +27,13 @@ impl std::fmt::Display for Value {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum IRKind { pub enum IRKind {
Value { value: Value },
Vector { values: Vec<Self> },
Unary { op: String, right: Box<Self> },
Binary { op: String, left: Box<Self>, right: Box<Self> },
Call { name: String, args: Vec<Self> },
Intrinsic { name: String, args: Vec<Self> },
Define { Define {
public: bool, public: bool,
name: String, name: String,
@ -42,16 +49,9 @@ pub enum IRKind {
body: Box<Self> body: Box<Self>
}, },
Call { name: String, args: Vec<Self> },
Intrinsic { name: String, args: Vec<Self> },
Do { body: Vec<Self> },
If { cond: Box<Self>, body: Box<Self>, else_body: Box<Self> }, If { cond: Box<Self>, body: Box<Self>, else_body: Box<Self> },
Case { cond: Box<Self>, cases: Vec<(Box<Self>, Box<Self>)>, default: Box<Self> }, Case { cond: Box<Self>, cases: Vec<(Box<Self>, Box<Self>)>, default: Box<Self> },
Unary { op: String, right: Box<Self> }, Do { body: Vec<Self> },
Binary { op: String, left: Box<Self>, right: Box<Self> },
Value { value: Value },
Vector { values: Vec<Self> },
Return { value: Box<Self> }, Return { value: Box<Self> },
} }
@ -438,7 +438,7 @@ fn gen_type_hint(type_hint: &str) -> String {
"bool" => "boolean".to_string(), "bool" => "boolean".to_string(),
"string" => "string".to_string(), "string" => "string".to_string(),
"void" => "void".to_string(), "void" => "void".to_string(),
// TODO: Un-hardcode vector type // TODO: Un-hardcode types
"vec_int" => "number[]".to_string(), "vec_int" => "number[]".to_string(),
"vec_bool" => "boolean[]".to_string(), "vec_bool" => "boolean[]".to_string(),
"vec_str" => "string[]".to_string(), "vec_str" => "string[]".to_string(),

View file

@ -1,7 +1,7 @@
[package] [package]
name = "hazure" name = "hazure"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
version = "0.1.0" version = "0.1.1"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
@ -22,4 +22,4 @@ diagnostic = { path = "../diagnostic" }
# Codegen # Codegen
hir = { path = "../hir" } hir = { path = "../hir" }
codegen = { path = "../codegen" } codegen = { path = "../codegen" }