diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index dbf0992..40b73ec 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,10 +7,11 @@
-
-
-
-
+
+
+
+
+
@@ -64,12 +65,12 @@
- {
+ "selectedUrlAndAccountId": {
+ "url": "https://github.com/Robert-M-Lucas/whython-8.git",
+ "accountId": "dcb8df19-0b39-47e1-9073-4a54f7034be8"
}
-}]]>
+}
@@ -276,15 +277,10 @@
-
-
-
-
- 1718888868217
-
-
-
- 1718888868217
+
+
+
+
@@ -670,7 +666,15 @@
1723053543861
-
+
+
+ 1723054195988
+
+
+
+ 1723054195988
+
+
@@ -727,7 +731,6 @@
-
@@ -752,7 +755,8 @@
-
+
+
diff --git a/build/out.asm b/build/out.asm
index 8a2000f..a0801fe 100644
--- a/build/out.asm
+++ b/build/out.asm
@@ -120,68 +120,100 @@ main:
ret
-_19:
+_10:
+ push rbp
+ mov rbp, rsp
+ mov qword [rbp+16], 0
+ leave
+ ret
+
+
+_11:
push rbp
mov rbp, rsp
mov rax, [rbp+16]
add rax, 0x0000000000000000
- mov qword [rbp-16], rax
- mov rdx, qword [rbp-16]
- mov rax, qword [rdx+0]
- mov qword [rbp-8], rax
- mov rdi, __8_fstr
- mov rsi, [rbp-8]
- mov al, 0
- sub rsp, 16
- extern printf
- call printf
- add rsp, 16
- mov rax, [rbp+16]
- add rax, 0x0000000000000008
- mov qword [rbp-34], rax
- mov rdx, qword [rbp-34]
+ mov qword [rbp-17], rax
+ mov rdx, qword [rbp-17]
mov rax, qword [rdx+0]
- mov qword [rbp-26], rax
- mov rax, qword [rbp-26]
+ mov qword [rbp-9], rax
+ mov rax, qword [rbp-9]
cmp rax, 0
- jz __36_6
- mov byte [rbp-18], 0
- jmp __36_7
- __36_6:
- mov byte [rbp-18], 1
- __36_7:
- mov al, byte [rbp-18]
- cmp al, 0
- jz __23_8
- mov byte [rbp-17], 0
- jmp __23_9
- __23_8:
- mov byte [rbp-17], 1
- __23_9:
- cmp byte [rbp-17], 0
- jz _19_10
+ jz __36_16
+ mov byte [rbp-1], 0
+ jmp __36_17
+ __36_16:
+ mov byte [rbp-1], 1
+ __36_17:
+ cmp byte [rbp-1], 0
+ jz _11_19
mov rax, [rbp+16]
- add rax, 0x0000000000000008
- mov qword [rbp-42], rax
- mov rdx, qword [rbp-42]
+ add rax, 0x0000000000000000
+ mov qword [rbp-25], rax
+ mov rax, qword [rbp+24]
+ mov qword [rbp-41], rax
+ mov rax, qword [rbp-41]
+ mov qword [rbp-57], rax
+ sub rsp, 0x0000000000000039
+ call _15
+ add rsp, 0x0000000000000039
+ mov rax, qword [rbp-49]
+ mov qword [rbp-33], rax
+ mov rdx, qword [rbp-25]
+ mov rax, qword [rbp-33]
+ mov qword [rdx+0], rax
+ jmp _11_18
+ _11_19:
+ mov rax, [rbp+16]
+ add rax, 0x0000000000000000
+ mov qword [rbp-25], rax
+ mov rdx, qword [rbp-25]
mov rax, qword [rdx+0]
- mov qword [rbp-50], rax
- mov rax, qword [rbp-50]
- mov qword [rbp-58], rax
- sub rsp, 0x000000000000003a
- call _19
- add rsp, 0x000000000000003a
- _19_11:
- _19_10:
+ mov qword [rbp-33], rax
+ mov rax, qword [rbp+24]
+ mov qword [rbp-41], rax
+ mov rax, qword [rbp-41]
+ mov qword [rbp-65], rax
+ mov rax, qword [rbp-33]
+ mov qword [rbp-73], rax
+ sub rsp, 0x0000000000000049
+ call _16
+ add rsp, 0x0000000000000049
+ _11_20:
+ _11_18:
leave
ret
-_18:
+_12:
push rbp
mov rbp, rsp
mov rax, [rbp+16]
- add rax, 0x0000000000000008
+ add rax, 0x0000000000000000
+ mov qword [rbp-8], rax
+ mov rdx, qword [rbp-8]
+ mov rax, qword [rdx+0]
+ mov qword [rbp-16], rax
+ mov rax, qword [rbp+24]
+ mov qword [rbp-24], rax
+ mov rax, qword [rbp-24]
+ mov qword [rbp-48], rax
+ mov rax, qword [rbp-16]
+ mov qword [rbp-56], rax
+ sub rsp, 0x0000000000000038
+ call _17
+ add rsp, 0x0000000000000038
+ mov rax, qword [rbp-40]
+ mov qword [rbp+32], rax
+ leave
+ ret
+
+
+_13:
+ push rbp
+ mov rbp, rsp
+ mov rax, [rbp+16]
+ add rax, 0x0000000000000000
mov qword [rbp-17], rax
mov rdx, qword [rbp-17]
mov rax, qword [rdx+0]
@@ -194,16 +226,16 @@ _18:
mov qword [rbp-9], rax
mov rax, qword [rbp-9]
cmp rax, 0
- jz __36_30
+ jz __36_26
mov byte [rbp-1], 0
- jmp __36_31
- __36_30:
+ jmp __36_27
+ __36_26:
mov byte [rbp-1], 1
- __36_31:
+ __36_27:
cmp byte [rbp-1], 0
- jz _18_32
+ jz _13_28
mov rax, [rbp+16]
- add rax, 0x0000000000000008
+ add rax, 0x0000000000000000
mov qword [rbp-49], rax
mov rdx, qword [rbp-49]
mov rax, qword [rdx+0]
@@ -215,7 +247,7 @@ _18:
mov rax, qword [rdx+0]
mov qword [rbp-41], rax
mov rax, [rbp+16]
- add rax, 0x0000000000000008
+ add rax, 0x0000000000000000
mov qword [rbp-81], rax
mov rdx, qword [rbp-81]
mov rax, qword [rdx+0]
@@ -226,7 +258,7 @@ _18:
call free
add rsp, 81
mov rax, [rbp+16]
- add rax, 0x0000000000000008
+ add rax, 0x0000000000000000
mov qword [rbp-89], rax
mov qword [rbp-97], 0
mov rdx, qword [rbp-89]
@@ -236,10 +268,10 @@ _18:
mov qword [rbp+24], rax
leave
ret
- _18_33:
- _18_32:
+ _13_29:
+ _13_28:
mov rax, [rbp+16]
- add rax, 0x0000000000000008
+ add rax, 0x0000000000000000
mov qword [rbp-41], rax
mov rdx, qword [rbp-41]
mov rax, qword [rdx+0]
@@ -255,6 +287,50 @@ _18:
ret
+_14:
+ push rbp
+ mov rbp, rsp
+ mov rax, [rbp+16]
+ add rax, 0x0000000000000000
+ mov qword [rbp-18], rax
+ mov rdx, qword [rbp-18]
+ mov rax, qword [rdx+0]
+ mov qword [rbp-10], rax
+ mov rax, qword [rbp-10]
+ cmp rax, 0
+ jz __36_4
+ mov byte [rbp-2], 0
+ jmp __36_5
+ __36_4:
+ mov byte [rbp-2], 1
+ __36_5:
+ mov al, byte [rbp-2]
+ cmp al, 0
+ jz __23_6
+ mov byte [rbp-1], 0
+ jmp __23_7
+ __23_6:
+ mov byte [rbp-1], 1
+ __23_7:
+ cmp byte [rbp-1], 0
+ jz _14_8
+ mov rax, [rbp+16]
+ add rax, 0x0000000000000000
+ mov qword [rbp-26], rax
+ mov rdx, qword [rbp-26]
+ mov rax, qword [rdx+0]
+ mov qword [rbp-34], rax
+ mov rax, qword [rbp-34]
+ mov qword [rbp-42], rax
+ sub rsp, 0x000000000000002a
+ call _19
+ add rsp, 0x000000000000002a
+ _14_9:
+ _14_8:
+
+leave
+ret
+
_15:
push rbp
mov rbp, rsp
@@ -278,87 +354,6 @@ _15:
ret
-_12:
- push rbp
- mov rbp, rsp
- mov rax, [rbp+16]
- add rax, 0x0000000000000000
- mov qword [rbp-8], rax
- mov rdx, qword [rbp-8]
- mov rax, qword [rdx+0]
- mov qword [rbp-16], rax
- mov rax, qword [rbp+24]
- mov qword [rbp-24], rax
- mov rax, qword [rbp-24]
- mov qword [rbp-48], rax
- mov rax, qword [rbp-16]
- mov qword [rbp-56], rax
- sub rsp, 0x0000000000000038
- call _17
- add rsp, 0x0000000000000038
- mov rax, qword [rbp-40]
- mov qword [rbp+32], rax
- leave
- ret
-
-
-_11:
- push rbp
- mov rbp, rsp
- mov rax, [rbp+16]
- add rax, 0x0000000000000000
- mov qword [rbp-17], rax
- mov rdx, qword [rbp-17]
- mov rax, qword [rdx+0]
- mov qword [rbp-9], rax
- mov rax, qword [rbp-9]
- cmp rax, 0
- jz __36_16
- mov byte [rbp-1], 0
- jmp __36_17
- __36_16:
- mov byte [rbp-1], 1
- __36_17:
- cmp byte [rbp-1], 0
- jz _11_19
- mov rax, [rbp+16]
- add rax, 0x0000000000000000
- mov qword [rbp-25], rax
- mov rax, qword [rbp+24]
- mov qword [rbp-41], rax
- mov rax, qword [rbp-41]
- mov qword [rbp-57], rax
- sub rsp, 0x0000000000000039
- call _15
- add rsp, 0x0000000000000039
- mov rax, qword [rbp-49]
- mov qword [rbp-33], rax
- mov rdx, qword [rbp-25]
- mov rax, qword [rbp-33]
- mov qword [rdx+0], rax
- jmp _11_18
- _11_19:
- mov rax, [rbp+16]
- add rax, 0x0000000000000000
- mov qword [rbp-25], rax
- mov rdx, qword [rbp-25]
- mov rax, qword [rdx+0]
- mov qword [rbp-33], rax
- mov rax, qword [rbp+24]
- mov qword [rbp-41], rax
- mov rax, qword [rbp-41]
- mov qword [rbp-65], rax
- mov rax, qword [rbp-33]
- mov qword [rbp-73], rax
- sub rsp, 0x0000000000000049
- call _16
- add rsp, 0x0000000000000049
- _11_20:
- _11_18:
-
-leave
-ret
-
_16:
push rbp
mov rbp, rsp
@@ -424,14 +419,14 @@ _17:
mov qword [rbp-17], 0
mov rax, qword [rbp-9]
cmp rax, qword [rbp-17]
- jz __16_26
+ jz __16_0
mov byte [rbp-1], 0
- jmp __16_27
- __16_26:
+ jmp __16_1
+ __16_0:
mov byte [rbp-1], 1
- __16_27:
+ __16_1:
cmp byte [rbp-1], 0
- jz _17_28
+ jz _17_2
mov rax, [rbp+16]
add rax, 0x0000000000000000
mov qword [rbp-25], rax
@@ -440,8 +435,8 @@ _17:
mov qword [rbp+32], rax
leave
ret
- _17_29:
- _17_28:
+ _17_3:
+ _17_2:
mov rax, [rbp+16]
add rax, 0x0000000000000008
mov qword [rbp-25], rax
@@ -467,55 +462,11 @@ _17:
ret
-_14:
- push rbp
- mov rbp, rsp
- mov rax, [rbp+16]
- add rax, 0x0000000000000000
- mov qword [rbp-18], rax
- mov rdx, qword [rbp-18]
- mov rax, qword [rdx+0]
- mov qword [rbp-10], rax
- mov rax, qword [rbp-10]
- cmp rax, 0
- jz __36_0
- mov byte [rbp-2], 0
- jmp __36_1
- __36_0:
- mov byte [rbp-2], 1
- __36_1:
- mov al, byte [rbp-2]
- cmp al, 0
- jz __23_2
- mov byte [rbp-1], 0
- jmp __23_3
- __23_2:
- mov byte [rbp-1], 1
- __23_3:
- cmp byte [rbp-1], 0
- jz _14_4
- mov rax, [rbp+16]
- add rax, 0x0000000000000000
- mov qword [rbp-26], rax
- mov rdx, qword [rbp-26]
- mov rax, qword [rdx+0]
- mov qword [rbp-34], rax
- mov rax, qword [rbp-34]
- mov qword [rbp-42], rax
- sub rsp, 0x000000000000002a
- call _19
- add rsp, 0x000000000000002a
- _14_5:
- _14_4:
-
-leave
-ret
-
-_13:
+_18:
push rbp
mov rbp, rsp
mov rax, [rbp+16]
- add rax, 0x0000000000000000
+ add rax, 0x0000000000000008
mov qword [rbp-17], rax
mov rdx, qword [rbp-17]
mov rax, qword [rdx+0]
@@ -528,16 +479,16 @@ _13:
mov qword [rbp-9], rax
mov rax, qword [rbp-9]
cmp rax, 0
- jz __36_12
+ jz __36_30
mov byte [rbp-1], 0
- jmp __36_13
- __36_12:
+ jmp __36_31
+ __36_30:
mov byte [rbp-1], 1
- __36_13:
+ __36_31:
cmp byte [rbp-1], 0
- jz _13_14
+ jz _18_32
mov rax, [rbp+16]
- add rax, 0x0000000000000000
+ add rax, 0x0000000000000008
mov qword [rbp-49], rax
mov rdx, qword [rbp-49]
mov rax, qword [rdx+0]
@@ -549,7 +500,7 @@ _13:
mov rax, qword [rdx+0]
mov qword [rbp-41], rax
mov rax, [rbp+16]
- add rax, 0x0000000000000000
+ add rax, 0x0000000000000008
mov qword [rbp-81], rax
mov rdx, qword [rbp-81]
mov rax, qword [rdx+0]
@@ -560,7 +511,7 @@ _13:
call free
add rsp, 81
mov rax, [rbp+16]
- add rax, 0x0000000000000000
+ add rax, 0x0000000000000008
mov qword [rbp-89], rax
mov qword [rbp-97], 0
mov rdx, qword [rbp-89]
@@ -570,10 +521,10 @@ _13:
mov qword [rbp+24], rax
leave
ret
- _13_15:
- _13_14:
+ _18_33:
+ _18_32:
mov rax, [rbp+16]
- add rax, 0x0000000000000000
+ add rax, 0x0000000000000008
mov qword [rbp-41], rax
mov rdx, qword [rbp-41]
mov rax, qword [rdx+0]
@@ -589,13 +540,62 @@ _13:
ret
-_10:
+_19:
push rbp
mov rbp, rsp
- mov qword [rbp+16], 0
- leave
- ret
+ mov rax, [rbp+16]
+ add rax, 0x0000000000000000
+ mov qword [rbp-16], rax
+ mov rdx, qword [rbp-16]
+ mov rax, qword [rdx+0]
+ mov qword [rbp-8], rax
+ mov rdi, __8_fstr
+ mov rsi, [rbp-8]
+ mov al, 0
+ sub rsp, 16
+ extern printf
+ call printf
+ add rsp, 16
+ mov rax, [rbp+16]
+ add rax, 0x0000000000000008
+ mov qword [rbp-34], rax
+ mov rdx, qword [rbp-34]
+ mov rax, qword [rdx+0]
+ mov qword [rbp-26], rax
+ mov rax, qword [rbp-26]
+ cmp rax, 0
+ jz __36_10
+ mov byte [rbp-18], 0
+ jmp __36_11
+ __36_10:
+ mov byte [rbp-18], 1
+ __36_11:
+ mov al, byte [rbp-18]
+ cmp al, 0
+ jz __23_12
+ mov byte [rbp-17], 0
+ jmp __23_13
+ __23_12:
+ mov byte [rbp-17], 1
+ __23_13:
+ cmp byte [rbp-17], 0
+ jz _19_14
+ mov rax, [rbp+16]
+ add rax, 0x0000000000000008
+ mov qword [rbp-42], rax
+ mov rdx, qword [rbp-42]
+ mov rax, qword [rdx+0]
+ mov qword [rbp-50], rax
+ mov rax, qword [rbp-50]
+ mov qword [rbp-58], rax
+ sub rsp, 0x000000000000003a
+ call _19
+ add rsp, 0x000000000000003a
+ _19_15:
+ _19_14:
+leave
+ret
section .data_readonly
__42_fstr db `\n`,0
diff --git a/build/out.o b/build/out.o
index 3da623c..0325874 100644
Binary files a/build/out.o and b/build/out.o differ
diff --git a/build/out.out b/build/out.out
index ce1d80e..c517ce4 100755
Binary files a/build/out.out and b/build/out.out differ
diff --git a/src/root/errors/mod.rs b/src/root/errors/mod.rs
index 6cd7378..52049f1 100644
--- a/src/root/errors/mod.rs
+++ b/src/root/errors/mod.rs
@@ -4,10 +4,10 @@ use std::fmt::{Display, Formatter};
use color_print::cformat;
-#[cfg(debug_assertions)]
-use crate::root::DEBUG_ON_ERROR;
use crate::root::parser::location::Location;
use crate::root::parser::path_storage::PathStorage;
+#[cfg(debug_assertions)]
+use crate::root::DEBUG_ON_ERROR;
pub mod evaluable_errors;
pub mod name_resolver_errors;
diff --git a/src/root/name_resolver/name_resolvers.rs b/src/root/name_resolver/name_resolvers.rs
index 9350d39..17678ac 100644
--- a/src/root/name_resolver/name_resolvers.rs
+++ b/src/root/name_resolver/name_resolvers.rs
@@ -8,18 +8,18 @@ use crate::root::errors::name_resolver_errors::NRErrs;
use crate::root::errors::WErr;
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature;
use crate::root::parser::location::Location;
-use crate::root::parser::parse_function::FunctionToken;
use crate::root::parser::parse_function::parse_evaluable::{
FullNameToken, FullNameTokens, UnresolvedTypeRefToken,
};
use crate::root::parser::parse_function::parse_operator::{OperatorToken, PrefixOrInfixEx};
+use crate::root::parser::parse_function::FunctionToken;
use crate::root::parser::parse_name::SimpleNameToken;
use crate::root::parser::parse_struct::StructToken;
use crate::root::parser::path_storage::FileID;
-use crate::root::POINTER_SIZE;
use crate::root::shared::common::{AddressedTypeRef, ByteSize, FunctionID, TypeID, TypeRef};
use crate::root::shared::types::Type;
use crate::root::unrandom::new_hashmap;
+use crate::root::POINTER_SIZE;
#[derive(Debug)]
enum NameTreeEntry {
@@ -51,9 +51,7 @@ struct TopLevelNameTree {
impl TopLevelNameTree {
pub fn get_tree_mut(&mut self, file_id: FileID) -> &mut NameTree {
- if !self.table.contains_key(&file_id) {
- self.table.insert(file_id, Default::default());
- }
+ self.table.entry(file_id).or_default();
self.table.get_mut(&file_id).unwrap()
}
diff --git a/src/root/parser/location.rs b/src/root/parser/location.rs
index 0654e04..d3470f9 100644
--- a/src/root/parser/location.rs
+++ b/src/root/parser/location.rs
@@ -23,7 +23,7 @@ impl<'a> ToLocation<'a> {
ToLocation::Span(span)
}
- pub fn to_location(self) -> Location {
+ pub fn into_location(self) -> Location {
match self {
ToLocation::Location(location) => location,
ToLocation::Span(s) => Location::from_span(&s),
diff --git a/src/root/parser/parse.rs b/src/root/parser/parse.rs
index 005f802..e21791e 100644
--- a/src/root/parser/parse.rs
+++ b/src/root/parser/parse.rs
@@ -28,18 +28,18 @@ pub fn parse(path_storage: &mut PathStorage) -> Result, WErr
print!("\n - {}", &reconstructed);
let Ok(text) = fs::read_to_string(Path::new(&reconstructed)) else {
return WErr::ne(
- ParseError::FailedToOpenFile(format!("{}", reconstructed)),
+ ParseError::FailedToOpenFile(reconstructed.to_string()),
location,
);
};
let base = Span::new_extra(&text, file_id);
- let (after_use, new_files) = handle_error(parse_uses(base, path_storage), &path_storage)?;
+ let (after_use, new_files) = handle_error(parse_uses(base, path_storage), path_storage)?;
path_queue.extend(new_files);
let res = parse_toplevel::parse_toplevel(after_use);
- let (remaining, new_output) = handle_error(res, &path_storage)?;
+ let (remaining, new_output) = handle_error(res, path_storage)?;
debug_assert!(remaining.is_empty());
output.extend(new_output);
}
diff --git a/src/root/parser/parse_blocks.rs b/src/root/parser/parse_blocks.rs
index bbc750e..dc7c8fe 100644
--- a/src/root/parser/parse_blocks.rs
+++ b/src/root/parser/parse_blocks.rs
@@ -1,7 +1,7 @@
-use nom::{InputTake, Offset};
use nom::bytes::complete::tag;
use nom::character::complete::{anychar, char as nchar};
use nom::error::{ErrorKind, ParseError};
+use nom::{InputTake, Offset};
use crate::root::errors::parser_errors::create_custom_error;
use crate::root::parser::parse::{ErrorTree, ParseResult, Span};
diff --git a/src/root/parser/path_storage.rs b/src/root/parser/path_storage.rs
index 213cde4..dfefaa7 100644
--- a/src/root/parser/path_storage.rs
+++ b/src/root/parser/path_storage.rs
@@ -105,7 +105,7 @@ impl PathStorage {
}
pub fn reconstruct_folder(&self, id: FolderID) -> String {
- let mut sb = format!("{}", &self.get_folder(id).current);
+ let mut sb = self.get_folder(id).current.to_string();
let mut current = self.get_folder(id).parent;
while current.0 != 0 {
sb = self.get_folder(current).current.clone() + "/" + &sb;
diff --git a/src/root/shared/common.rs b/src/root/shared/common.rs
index 52822f2..a495950 100644
--- a/src/root/shared/common.rs
+++ b/src/root/shared/common.rs
@@ -67,9 +67,7 @@ impl Indirection {
}
}
-#[derive(
- Debug, PartialEq, Eq, Hash, Copy, Clone, Default, Add, AddAssign, Sub, SubAssign,
-)]
+#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, Default, Add, AddAssign, Sub, SubAssign)]
/// The size of something, in bytes
pub struct ByteSize(pub usize);