fixed minor spelling mistake

This commit is contained in:
Goren Barak 2023-11-17 15:40:09 -05:00
parent ba3455fcff
commit 60527bba91
3 changed files with 8 additions and 7 deletions

View file

@ -91,8 +91,8 @@ pub fn fasm_codegen(exprs: Vec<Expr>) -> String {
asm_text.push_str(format!("call {}", e.name).as_str()); asm_text.push_str(format!("call {}", e.name).as_str());
}, },
Expr::VarDefenition(e) => { Expr::VarDefinition(e) => {
asm_data.push_str(format!("\t{} dq {}", e.name, e.value.unwrap()).as_str()); asm_data.push_str(format!("\t{} dq {}", e.name, e.value.unwrap()).as_str());
}, },
Expr::VarReference(e) => { Expr::VarReference(e) => {

View file

@ -7,5 +7,5 @@ use crate::parse::ast::*;
pub mod parse; pub mod parse;
fn main() { 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]);
} }

View file

@ -2,8 +2,8 @@
pub enum Expr<'a> { pub enum Expr<'a> {
MathExpr(Math<'a>), MathExpr(Math<'a>),
FunCall(FunCall<'a>), FunCall(FunCall<'a>),
FunDefenition(FunDefenition<'a>), FunDefinition(FunDefinition<'a>),
VarDefenition(VarDefenition<'a>), VarDefinition(VarDefinition<'a>),
VarReference(VarReference<'a>), VarReference(VarReference<'a>),
Breakpoint Breakpoint
} }
@ -35,7 +35,7 @@ pub struct FunCall<'a> {
} }
#[derive(Debug)] #[derive(Debug)]
pub struct FunDefenition<'a> { pub struct FunDefinition<'a> {
name: &'a str, name: &'a str,
params: Vec<FunParamDef<'a>>, params: Vec<FunParamDef<'a>>,
contents: Vec<Expr<'a>>, contents: Vec<Expr<'a>>,
@ -45,6 +45,7 @@ pub struct FunDefenition<'a> {
#[derive(Debug)] #[derive(Debug)]
pub struct FunParamDef<'a> { pub struct FunParamDef<'a> {
name: &'a str, name: &'a str,
number: u8,
} }
#[derive(Debug)] #[derive(Debug)]
@ -55,7 +56,7 @@ pub struct FunParamCall<'a> {
// VARIABLES // VARIABLES
#[derive(Debug)] #[derive(Debug)]
pub struct VarDefenition<'a> { pub struct VarDefinition<'a> {
pub name: &'a str, pub name: &'a str,
pub value: Value<'a>, pub value: Value<'a>,
} }