Skip to content
This repository was archived by the owner on Nov 29, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2a42255
feat: added field usage count tracking
Zffu Apr 14, 2026
37595c3
feat: added global scope storage
Zffu Apr 14, 2026
f6ddd98
feat: added Display to entries
Zffu Apr 15, 2026
239cae0
feat: added getters to the GlobalScopeStorage to enforce entry type
Zffu Apr 15, 2026
50217ba
feat: added new prelude crate
Zffu Apr 15, 2026
5faa326
feat: added prelude apply on HIR
Zffu Apr 15, 2026
aeafba1
feat: added sample types in prelude
Zffu Apr 19, 2026
73587f1
chore: added dummy origin for prelude applying
Zffu Apr 19, 2026
a1e27cf
chore: added global scope crate
Zffu Apr 20, 2026
7deb23c
feat: added global scope storage definition
Zffu Apr 20, 2026
2ae03b4
feat: added binding in compiler_typing
Zffu Apr 20, 2026
c9ecc43
feat: changed to use indexes for non type items
Zffu Apr 20, 2026
fb8bfdc
feat: added util conversion functions on GlobalStorageEntry
Zffu Apr 20, 2026
0e62c74
chore: formatted everything using rustfmt
Zffu Apr 20, 2026
c55ffad
fix: fixed HIR
Zffu Apr 20, 2026
fbbfd62
fix: fixed MIR
Zffu Apr 20, 2026
cdda6e6
fix: fixed up global scope to work
Zffu Apr 21, 2026
c61815f
feat: added global scope HIR version
Zffu Apr 21, 2026
fd4d5e8
feat: added HIR scope append functions
Zffu Apr 21, 2026
51e9199
feat: added getters
Zffu Apr 21, 2026
a3420cf
fix: fixed some errors
Zffu Apr 21, 2026
1022eb9
fix: fixed some errors
Zffu Apr 21, 2026
52e7053
feat: added branched contexts inside of HIR global scope
Zffu Apr 21, 2026
d1eb351
feat: cleaned HIR Context out of global scope contained elements
Zffu Apr 21, 2026
7276b82
feat: cleaned nodes to use global scope
Zffu Apr 21, 2026
005a2fc
feat: lowered HIR functions to global scope
Zffu Apr 21, 2026
586eab1
fix: fixed HIR lowering layer from errors
Zffu Apr 21, 2026
1a77fbc
fix: fixed MIR lowering layer
Zffu Apr 21, 2026
d4a54a0
feat: added getters for function ctx
Zffu Apr 21, 2026
7b5fa0b
feat: added append half function method
Zffu Apr 21, 2026
0cb18fb
fix: added fixes for global scope
Zffu Apr 21, 2026
0e92465
feat: prevented global scope -> local scope duplicate entries by chec…
Zffu Apr 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[workspace]
members = ["compiler/ast", "compiler/ast_parser", "compiler/astoir", "compiler/astoir_hir", "compiler/astoir_hir_lowering", "compiler/astoir_mir", "compiler/compiler_typing", "compiler/astoir_mir_lowering", "compiler/compiler_main", "compiler/compiler_utils", "compiler/llvm_ir_bridge", "compiler/diagnostics"]
members = ["compiler/ast", "compiler/ast_parser", "compiler/astoir", "compiler/astoir_hir", "compiler/astoir_hir_lowering", "compiler/astoir_mir", "compiler/compiler_typing", "compiler/astoir_mir_lowering", "compiler/compiler_main", "compiler/compiler_utils", "compiler/llvm_ir_bridge", "compiler/diagnostics", "compiler/prelude", "compiler/compiler_global_scope"]
37 changes: 20 additions & 17 deletions compiler/ast/src/ctx.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
use std::{collections::HashMap};
use std::collections::HashMap;

use crate::tree::ASTTreeNode;

#[derive(Debug)]
pub struct ParserCtx {
pub map: HashMap<String, Box<ASTTreeNode>>,
pub uses: Vec<Box<ASTTreeNode>>,
pub iter_order: Vec<String>
pub map: HashMap<String, Box<ASTTreeNode>>,
pub uses: Vec<Box<ASTTreeNode>>,
pub iter_order: Vec<String>,
}

impl ParserCtx {
pub fn new() -> Self {
return ParserCtx { map: HashMap::new(), iter_order: Vec::new(), uses: vec![] }
}
pub fn new() -> Self {
return ParserCtx {
map: HashMap::new(),
iter_order: Vec::new(),
uses: vec![],
};
}

pub fn insert(&mut self, name: String, node: Box<ASTTreeNode>) -> bool {
if !node.kind.is_tree_permissible() {
return false;
}
pub fn insert(&mut self, name: String, node: Box<ASTTreeNode>) -> bool {
if !node.kind.is_tree_permissible() {
return false;
}

self.iter_order.push(name.clone());
self.iter_order.push(name.clone());

self.map.insert(name, node);
return true;
}

}
self.map.insert(name, node);
return true;
}
}
6 changes: 3 additions & 3 deletions compiler/ast/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//!
//! The AST module of Quickfall. Contains all of the AST code required for the Quickfall language.
//!
//!

pub mod tree;
pub mod ctx;
pub mod operators;
pub mod tree;
pub mod types;
pub mod operators;
192 changes: 102 additions & 90 deletions compiler/ast/src/operators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,95 +4,107 @@ use compiler_utils::operators::{ComparingOperator, MathOperator, MathOperatorTyp
use diagnostics::{DiagnosticResult, builders::make_unexpected_simple_error};
use lexer::token::{LexerToken, LexerTokenType};

pub fn parse_math_operator(tokens: &Vec<LexerToken>, ind: &mut usize) -> DiagnosticResult<MathOperator> {
let op = match tokens[*ind].tok_type {
LexerTokenType::Plus => MathOperatorType::Add,
LexerTokenType::PercentSign => MathOperatorType::Modulo,
LexerTokenType::Minus => MathOperatorType::Subtract,
LexerTokenType::Asterisk => {
if tokens[*ind + 1].tok_type == LexerTokenType::Asterisk {
*ind += 1;

MathOperatorType::ShiftLeft
} else {
MathOperatorType::Multiply
}
}
LexerTokenType::Divide => {
if tokens[*ind + 1].tok_type == LexerTokenType::Divide {
*ind += 1;

MathOperatorType::ShiftRight
} else {
MathOperatorType::Divide
}
}

_ => return Err(make_unexpected_simple_error(&tokens[*ind], &tokens[*ind].tok_type).into())
};

*ind += 1;

let assigns = match tokens[*ind].tok_type {
LexerTokenType::EqualSign => true,
_ => false
};

if assigns {
*ind += 1;
}

let fast = match tokens[*ind].tok_type {
LexerTokenType::Tidle => true,
_ => false
};

if fast {
*ind += 1;
}

return Ok(MathOperator { operator: op, assigns, fast });
pub fn parse_math_operator(
tokens: &Vec<LexerToken>,
ind: &mut usize,
) -> DiagnosticResult<MathOperator> {
let op = match tokens[*ind].tok_type {
LexerTokenType::Plus => MathOperatorType::Add,
LexerTokenType::PercentSign => MathOperatorType::Modulo,
LexerTokenType::Minus => MathOperatorType::Subtract,
LexerTokenType::Asterisk => {
if tokens[*ind + 1].tok_type == LexerTokenType::Asterisk {
*ind += 1;

MathOperatorType::ShiftLeft
} else {
MathOperatorType::Multiply
}
}
LexerTokenType::Divide => {
if tokens[*ind + 1].tok_type == LexerTokenType::Divide {
*ind += 1;

MathOperatorType::ShiftRight
} else {
MathOperatorType::Divide
}
}

_ => {
return Err(make_unexpected_simple_error(&tokens[*ind], &tokens[*ind].tok_type).into());
}
};

*ind += 1;

let assigns = match tokens[*ind].tok_type {
LexerTokenType::EqualSign => true,
_ => false,
};

if assigns {
*ind += 1;
}

let fast = match tokens[*ind].tok_type {
LexerTokenType::Tidle => true,
_ => false,
};

if fast {
*ind += 1;
}

return Ok(MathOperator {
operator: op,
assigns,
fast,
});
}

pub fn parse_compare_operator(tokens: &Vec<LexerToken>, ind: &mut usize) -> DiagnosticResult<ComparingOperator> {
let eq = match tokens[*ind + 1].tok_type {
LexerTokenType::EqualSign => true,
_ => false
};

let op = match tokens[*ind].tok_type {
LexerTokenType::EqualSign => {
tokens[*ind + 1].expects(LexerTokenType::EqualSign)?;

ComparingOperator::Equal
},

LexerTokenType::ExclamationMark => {
tokens[*ind + 1].expects(LexerTokenType::EqualSign)?;

ComparingOperator::NotEqual
},

LexerTokenType::AngelBracketOpen => {
if eq {
ComparingOperator::LowerEqual
} else {
ComparingOperator::Lower
}
},

LexerTokenType::AngelBracketClose => {
if eq {
ComparingOperator::HigherEqual
} else {
ComparingOperator::Higher
}
},

_ => {
return Err(make_unexpected_simple_error(&tokens[*ind], &tokens[*ind].tok_type).into())
}
};

return Ok(op);
}
pub fn parse_compare_operator(
tokens: &Vec<LexerToken>,
ind: &mut usize,
) -> DiagnosticResult<ComparingOperator> {
let eq = match tokens[*ind + 1].tok_type {
LexerTokenType::EqualSign => true,
_ => false,
};

let op = match tokens[*ind].tok_type {
LexerTokenType::EqualSign => {
tokens[*ind + 1].expects(LexerTokenType::EqualSign)?;

ComparingOperator::Equal
}

LexerTokenType::ExclamationMark => {
tokens[*ind + 1].expects(LexerTokenType::EqualSign)?;

ComparingOperator::NotEqual
}

LexerTokenType::AngelBracketOpen => {
if eq {
ComparingOperator::LowerEqual
} else {
ComparingOperator::Lower
}
}

LexerTokenType::AngelBracketClose => {
if eq {
ComparingOperator::HigherEqual
} else {
ComparingOperator::Higher
}
}

_ => {
return Err(make_unexpected_simple_error(&tokens[*ind], &tokens[*ind].tok_type).into());
}
};

return Ok(op);
}
Loading
Loading