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());
},
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) => {

View file

@ -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]);
}

View file

@ -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<FunParamDef<'a>>,
contents: Vec<Expr<'a>>,
@ -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>,
}