From 60527bba9160a187625e4accf086432c83686c7a Mon Sep 17 00:00:00 2001 From: Goren Barak Date: Fri, 17 Nov 2023 15:40:09 -0500 Subject: [PATCH] fixed minor spelling mistake --- src/codegen/fasm.rs | 4 ++-- src/main.rs | 2 +- src/parse/ast.rs | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/codegen/fasm.rs b/src/codegen/fasm.rs index a17236d..2ae1ee3 100644 --- a/src/codegen/fasm.rs +++ b/src/codegen/fasm.rs @@ -91,8 +91,8 @@ pub fn fasm_codegen(exprs: Vec) -> String { asm_text.push_str(format!("call {}", e.name).as_str()); }, - Expr::VarDefenition(e) => { - asm_data.push_str(format!("\t{} dq {}", e.name, e.value.unwrap()).as_str()); + Expr::VarDefinition(e) => { + asm_data.push_str(format!("\t{} dq {}", e.name, e.value.unwrap()).as_str()); }, Expr::VarReference(e) => { diff --git a/src/main.rs b/src/main.rs index 8172a89..c00d864 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,5 +7,5 @@ use crate::parse::ast::*; pub mod parse; fn main() { - fasm_codegen(vec![Expr::VarDefenition(VarDefenition {name: "goren", value: Value::Number(10)}), Expr::MathExpr(Math { left: Value::Var(VarReference { name: "goren"}), right: Value::Number(17), operator: MathOperator::OP_MOD}), Expr::Breakpoint]); + fasm_codegen(vec![Expr::VarDefinition(VarDefinition {name: "goren", value: Value::Number(10)}), Expr::MathExpr(Math { left: Value::Var(VarReference { name: "goren"}), right: Value::Number(17), operator: MathOperator::OP_MULT}), Expr::Breakpoint]); } diff --git a/src/parse/ast.rs b/src/parse/ast.rs index 345c9a9..ac9dca8 100644 --- a/src/parse/ast.rs +++ b/src/parse/ast.rs @@ -2,8 +2,8 @@ pub enum Expr<'a> { MathExpr(Math<'a>), FunCall(FunCall<'a>), - FunDefenition(FunDefenition<'a>), - VarDefenition(VarDefenition<'a>), + FunDefinition(FunDefinition<'a>), + VarDefinition(VarDefinition<'a>), VarReference(VarReference<'a>), Breakpoint } @@ -35,7 +35,7 @@ pub struct FunCall<'a> { } #[derive(Debug)] -pub struct FunDefenition<'a> { +pub struct FunDefinition<'a> { name: &'a str, params: Vec>, contents: Vec>, @@ -45,6 +45,7 @@ pub struct FunDefenition<'a> { #[derive(Debug)] pub struct FunParamDef<'a> { name: &'a str, + number: u8, } #[derive(Debug)] @@ -55,7 +56,7 @@ pub struct FunParamCall<'a> { // VARIABLES #[derive(Debug)] -pub struct VarDefenition<'a> { +pub struct VarDefinition<'a> { pub name: &'a str, pub value: Value<'a>, }