-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
begin work on type checking, inferencing, and semantics checking (#11)
* begin work on type checking, inferencing, and semantics checking * fmt * WIP; laptop dying * match branch types * wip type code blocks * build failure * operator parsing; no precedence * compile fn * run compile instead of parse from hllc * begin trait declarations in ast * return statements in AST * allow code blocks * handle implicit returns in code blocks * type checking is taking shape * generic type checking * return multiple errors * proper operator precedence * add fn params to namespace when typechecking * contextual error messages * remove todo panics * toml update
- Loading branch information
Showing
22 changed files
with
1,853 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[workspace] | ||
|
||
members = ["parser", "hllc", "ast"] | ||
members = ["parser", "hllc"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,35 @@ | ||
trait MyTrait { | ||
fn some_fn_thing(): u32 | ||
} { | ||
fn some_other_trait_thing(): bool { | ||
return true; | ||
} | ||
} | ||
contract { | ||
/* | ||
trait my_trait { | ||
fn someFnThing(): u32 | ||
} { | ||
fn some_other_trait_thing(): bool { | ||
return true; | ||
} | ||
} | ||
struct my_struct { | ||
FieldName: u64 | ||
} | ||
*/ | ||
fn contract_func_1(a: T, y: u32): T { | ||
println("Test function."); | ||
let z = x.a.b.c; | ||
let x: byte = { | ||
// a code block w/ implicit return | ||
let y = 0b11110000; | ||
y | ||
}; | ||
let example_variable_decl = 5; | ||
let y = if true { | ||
let x = 5; | ||
let z = 2; | ||
a | ||
} else { 10 }; | ||
|
||
a | ||
} | ||
|
||
fn contract_func_1(x: u32, y: u32): bool { | ||
println("Test function."); | ||
let x: byte = 0b11110000; | ||
let example_variable_decl = 5; | ||
return example_variable_decl; | ||
/* | ||
struct my_struct { | ||
FieldName: u64 | ||
} | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
contract { | ||
|
||
fn Main() { | ||
let x = 1 + (6 / 2 + 1 * 20); | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.