From 070b8b259c4f1d5823b03a13f72437934f222b8b Mon Sep 17 00:00:00 2001 From: Natapat Samutpong Date: Wed, 23 Mar 2022 08:18:37 +0700 Subject: [PATCH] very bumpy --- Cargo.lock | 2 +- crates/hir/src/lib.rs | 18 +++++++++--------- crates/main/Cargo.toml | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9e579ce..880dfbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -152,7 +152,7 @@ checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "hazure" -version = "0.1.0" +version = "0.1.1" dependencies = [ "clap", "codegen", diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index d65aa94..c233df2 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -27,6 +27,13 @@ impl std::fmt::Display for Value { #[derive(Debug, Clone)] pub enum IRKind { + Value { value: Value }, + Vector { values: Vec }, + Unary { op: String, right: Box }, + Binary { op: String, left: Box, right: Box }, + Call { name: String, args: Vec }, + Intrinsic { name: String, args: Vec }, + Define { public: bool, name: String, @@ -42,16 +49,9 @@ pub enum IRKind { body: Box }, - Call { name: String, args: Vec }, - Intrinsic { name: String, args: Vec }, - Do { body: Vec }, If { cond: Box, body: Box, else_body: Box }, Case { cond: Box, cases: Vec<(Box, Box)>, default: Box }, - Unary { op: String, right: Box }, - Binary { op: String, left: Box, right: Box }, - - Value { value: Value }, - Vector { values: Vec }, + Do { body: Vec }, Return { value: Box }, } @@ -438,7 +438,7 @@ fn gen_type_hint(type_hint: &str) -> String { "bool" => "boolean".to_string(), "string" => "string".to_string(), "void" => "void".to_string(), - // TODO: Un-hardcode vector type + // TODO: Un-hardcode types "vec_int" => "number[]".to_string(), "vec_bool" => "boolean[]".to_string(), "vec_str" => "string[]".to_string(), diff --git a/crates/main/Cargo.toml b/crates/main/Cargo.toml index fd11838..9d207fe 100644 --- a/crates/main/Cargo.toml +++ b/crates/main/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "hazure" license = "MIT OR Apache-2.0" -version = "0.1.0" +version = "0.1.1" edition = "2021" [dependencies] @@ -22,4 +22,4 @@ diagnostic = { path = "../diagnostic" } # Codegen hir = { path = "../hir" } -codegen = { path = "../codegen" } \ No newline at end of file +codegen = { path = "../codegen" }