Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-M-Lucas committed Jun 21, 2024
1 parent 3359e36 commit 96b05b5
Show file tree
Hide file tree
Showing 28 changed files with 393 additions and 211 deletions.

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

72 changes: 41 additions & 31 deletions .idea/workspace.xml

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

62 changes: 0 additions & 62 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ nom-supreme = "0.8.0"
substring = "1.4.5"
derive-getters = "0.4.0"
derive_more = "0.99.17"
pinned-init = "0.0.7"
arr_macro = "0.2.1"

[profile.release]
opt-level = 3
Expand Down
10 changes: 9 additions & 1 deletion build/out.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ section .text
main:
push rbp
mov rbp, rsp
mov qword [rbp-8], 1
mov qword [rbp-16], 12
mov rax, rbp
add rax, -16
mov qword [rbp-8], rax
mov qword [rbp-24], 1
mov rax, qword [rbp-8]
mov rdx, qword [rbp-24]
add qword [rax], rdx
mov qword [rbp-32], 1
mov rax, qword [rbp-32]
leave
ret

Expand Down
Binary file modified build/out.o
Binary file not shown.
3 changes: 1 addition & 2 deletions main.why
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fn main() -> int {
return 1;
printi(123);

}
13 changes: 12 additions & 1 deletion src/root/builtin/types/int/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use crate::root::builtin::types::int::p_add::IntPAdd;
use crate::root::builtin::types::int::p_sub::{IntAsSub, IntPSub};
use crate::root::builtin::types::int::printi::PrintI;
use crate::root::builtin::types::int::sub::IntSub;
use crate::root::compiler::compiler_errors::CError;
use crate::root::errors::evaluable_errors::EvalErrs;
use crate::root::errors::WErr;
use crate::root::name_resolver::name_resolvers::GlobalDefinitionTable;
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;
Expand Down Expand Up @@ -93,7 +95,16 @@ impl Type for IntType {
}
}
LiteralTokens::Int(value) => {
if *value < 2147483648 {
if *value > i64::MAX as i128 {
return WErr::ne(CError::IntLiteralExceedsMax(*value, i64::MAX as i128), literal.location().clone());
}
if *value < i64::MIN as i128 {
return WErr::ne(CError::IntLiteralBelowMin(*value, i64::MAX as i128), literal.location().clone());
}

let value = *value as i64;

if value < 2147483648 {
format!(" mov qword {location}, {value}\n")
}
else {
Expand Down
Loading

0 comments on commit 96b05b5

Please sign in to comment.