Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor error and warning handling #12

Merged
merged 2 commits into from
Mar 2, 2021
Merged

Refactor error and warning handling #12

merged 2 commits into from
Mar 2, 2021

Conversation

sezna
Copy link
Contributor

@sezna sezna commented Mar 2, 2021

My previous strategy to generalize over errors and warnings was not general enough, so this is a huge overhaul of that system. Also introduced the pub visibility keyword. Error recovery and type checking errors will be much better now.

Back to feature work as scheduled.

@sezna sezna changed the base branch from master to parser_v1 March 2, 2021 22:17
@sezna sezna merged commit f7261d0 into parser_v1 Mar 2, 2021
@sezna sezna deleted the refactor branch March 2, 2021 22:18
sezna added a commit that referenced this pull request May 8, 2021
* initial parsing work

* parse trait declarations

* import statements

* clean lexer tree; support method calls

* basic ast skeleton beginnings

* begin ast work

* checkpoint while i swap computers

* more ast parsing

* more ast parsing

* ast: function appl, func decl, var exp

* ast: literals

* add compiler binary with nice error messages

* ast: return statements, use statements

* fix error message

* ast: traits

* more friendly parse error messages

* old email

* semicolons!

* byte literals; fix tests

* parse binary and hex literals for byte and bytes32

* refactor expression parsing

* parse array exprs

* parse operator expressions

* type ascriptions

* parser: polymorphism and trait bounds

* default to u64 instead of u32

* begin work on match statements

* parse structs

* refactor

* a few program examples; parse match statements

* lex struct expressions

* parse to AST struct expressions

* compile warnings!

* assert_or_warn macro

* generic struct parameters

* parse contract/script/predicate

* improve top level failure error message

* s/ast/parse_tree

* enums

* begin semantic analysis

* 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

* small error msg tweak

* Refactor error and warning handling (#12)

* begin refactor of error/warnings

* finish refactor

* type check predicates

* limit number of script main functions

* parse generic types for traits

* grammar for reassignments and while loops

* variable reassignments; while loops

* check generic type params in function declarations

* fix tests

* grammar for inline asm

* Asm expressions (#13)

* begin implementing asm expressions

* WIP asm parsing

* fix up spans; unused value warning

* progress on trait impl

* impl traits

* big refactor

* fix asm op parsing error

* parsing for method applications

* struct expressions and declarations: type inference

* WIP subfield exprs

* subfield expressions

* baaasic method invocations

* impl self; better struct declarations

* begin package manager work

* begin work on package manager

* WIP checkpoint

* forc build MVP implemenation

* dependency resolution v1

* Namespace refactor (#22)

* begin namespace refactor

* move all hashmaps to namespace type

* compiles imported dependencies

* method not found error

* resolve some warnings

* fix Self type in trait implementations

* fix all warnings

* fix todo error messages

* introduce differentiation between generic and struct types

* refactor struct expression typing to use declarations

* fix lack of self type in trait implementation

* refactor typed expressions

* fix impl self namespace bug

* fix implicit return typechecking bug

* re-introduce function applications

* type check function return statements

* remove hllc

* fix only last expr having type annotation; if branch enforcement of having an else

* Control flow analysis + more (#28)

* begin documentation of control flow analysis algorithm

* begin graph construction

* begin graph construction

* generate graphs; further control flow work

* some improvements in control flow; still need to wire up imports into the control flow graph

* control flow graph improvements

* fix up implicit return printing in control flow graph

* organize graph code

* find dead code

* unreachable code warnings

* parse unit type as type info

* start enum expressions

* fix enum lookup bug

* type check all enum instantiations

* Resolved types (#29)

* begin swappnig over to resolved types

* progress in refactore

* progress on converting types

* progress in switching to resolved types

* progress in switching to resolved types

* finalize refactor to resolved types

* remove unused type variants

* fix tests

* enum variant construction code analysis

* resolve warnings

* missing enum instantiator error

* trait declarations control flow

* fix trait type mismatch error message

* individual method dead code warnings

* fix method call bug

* respect public visibility modifiers; control flow analysis on libraries

* add public traits

* move ident file

* begin analysis on return paths

* refactor of files

* begin work on analyzing return paths

* basic return path graph construction done

* documentation

* Return path analysis (#30)

* begin analysis on return paths

* refactor of files

* begin work on analyzing return paths

* basic return path graph construction done

* documentation

* fix code block type parsing

* control flow analysis on if and code blocks

* struct fields in graph

* individual struct field warnings

* add line_col method for errors and warnings

* Generate Assembly (#31)

* begin generating assembly

* add unique registers counter to asm expressions

* sketch out asm generation with todo! macros everywhere

* begin while loop assembly

* rework compile fn for asm

* have to commit to save my progress as i boot into windows for fortnite

* make progress in expression generation

* WIP: return statements

* asm expressions and asm refactor

* very basic bytecode compilation

* first asm!

* ASM: While loops and reassignments

* remove subsequent jumps

* reuse data section values for duplicate literals

* struct expressions

* fix SW order

* stashing checkpoint

* forgotten add

* asm for enum instantiations

* if expression assembly generation

* code block asm generation

* remove TODO in code analysis

* remove some panics

* remove a bunch of todo panics

Co-authored-by: Alexander Hansen <alexanderhansen@Alexanders-MacBook-Pro.local>

* move license; clean warnings

* Update forc/src/cli/build.rs

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* Update forc/src/cli/build.rs

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* code review feedback

* Update forc/src/manifest.rs

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* Update parser/src/control_flow_analysis/analyze_return_paths.rs

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* more PR feedback

* rename parser to core_lang

* add minimum supported version

* Update README.md

Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>

* check that struct size in words fits in a u32 gracefully

* forgotten import

Co-authored-by: Alexander Hansen <alexanderhansen@Alexanders-MacBook-Pro.local>
Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
@adlerjohn adlerjohn added the compiler General compiler. Should eventually become more specific as the issue is triaged label May 12, 2021
leviathanbeak added a commit that referenced this pull request May 21, 2021
* initial parsing work

* parse trait declarations

* import statements

* clean lexer tree; support method calls

* basic ast skeleton beginnings

* begin ast work

* checkpoint while i swap computers

* more ast parsing

* more ast parsing

* ast: function appl, func decl, var exp

* ast: literals

* add compiler binary with nice error messages

* ast: return statements, use statements

* fix error message

* ast: traits

* more friendly parse error messages

* old email

* semicolons!

* byte literals; fix tests

* parse binary and hex literals for byte and bytes32

* refactor expression parsing

* parse array exprs

* parse operator expressions

* type ascriptions

* parser: polymorphism and trait bounds

* default to u64 instead of u32

* begin work on match statements

* parse structs

* refactor

* a few program examples; parse match statements

* lex struct expressions

* parse to AST struct expressions

* compile warnings!

* assert_or_warn macro

* generic struct parameters

* parse contract/script/predicate

* improve top level failure error message

* s/ast/parse_tree

* enums

* begin semantic analysis

* 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

* small error msg tweak

* Refactor error and warning handling (#12)

* begin refactor of error/warnings

* finish refactor

* type check predicates

* limit number of script main functions

* parse generic types for traits

* grammar for reassignments and while loops

* variable reassignments; while loops

* check generic type params in function declarations

* fix tests

* grammar for inline asm

* Asm expressions (#13)

* begin implementing asm expressions

* WIP asm parsing

* fix up spans; unused value warning

* progress on trait impl

* impl traits

* big refactor

* fix asm op parsing error

* parsing for method applications

* struct expressions and declarations: type inference

* WIP subfield exprs

* subfield expressions

* baaasic method invocations

* impl self; better struct declarations

* begin package manager work

* begin work on package manager

* WIP checkpoint

* forc build MVP implemenation

* dependency resolution v1

* Namespace refactor (#22)

* begin namespace refactor

* move all hashmaps to namespace type

* compiles imported dependencies

* method not found error

* resolve some warnings

* fix Self type in trait implementations

* fix all warnings

* fix todo error messages

* introduce differentiation between generic and struct types

* refactor struct expression typing to use declarations

* fix lack of self type in trait implementation

* refactor typed expressions

* fix impl self namespace bug

* fix implicit return typechecking bug

* re-introduce function applications

* type check function return statements

* remove hllc

* fix only last expr having type annotation; if branch enforcement of having an else

* Control flow analysis + more (#28)

* begin documentation of control flow analysis algorithm

* begin graph construction

* begin graph construction

* generate graphs; further control flow work

* some improvements in control flow; still need to wire up imports into the control flow graph

* control flow graph improvements

* fix up implicit return printing in control flow graph

* organize graph code

* find dead code

* unreachable code warnings

* parse unit type as type info

* start enum expressions

* fix enum lookup bug

* type check all enum instantiations

* Resolved types (#29)

* begin swappnig over to resolved types

* progress in refactore

* progress on converting types

* progress in switching to resolved types

* progress in switching to resolved types

* finalize refactor to resolved types

* remove unused type variants

* fix tests

* enum variant construction code analysis

* resolve warnings

* missing enum instantiator error

* trait declarations control flow

* fix trait type mismatch error message

* individual method dead code warnings

* fix method call bug

* respect public visibility modifiers; control flow analysis on libraries

* add public traits

* move ident file

* begin analysis on return paths

* refactor of files

* begin work on analyzing return paths

* basic return path graph construction done

* documentation

* Return path analysis (#30)

* begin analysis on return paths

* refactor of files

* begin work on analyzing return paths

* basic return path graph construction done

* documentation

* fix code block type parsing

* control flow analysis on if and code blocks

* struct fields in graph

* individual struct field warnings

* added ignore vscode local settings

* added forc commands and restructured files

* format code

* ignore node modules

* added syntax highlighting in vscode-forc

* rename to snippets

* change to fume

* added fume-server as a member

* updated .gitignore with ts files

* added vscode client

* update package.json

* added initial fume-server

* add line_col method for errors and warnings

* adding capabilities

* installed ropey

* update to new structure

* perform diagnostic

* added text_document

* remove unused

* cargo fmt

* clean up

* introduce better document state managment

* added hover and completion

* fixed ranges

* added semantic tokens, go to defnition

* remove other go_tos

* clean up

* update merging with master

* added clear names

* move to token references

* rename to get_diagnostics

* fix master conflicts

* make public fields

* use core_lang instead of parser

* adjust to new parse result

* update plugin start instructions

* fix typo

* clear both lines and values hashmaps

* remove unused enum fields

* move settings.json ignore to git/info/exclude

* re-added appache license

* added MANIFEST_FILE_NAME

* formatted toml files

* fromatted launch.json

* add static values for token types

* format

* fix typo

Co-authored-by: Alex <alex@42layers.io>
Co-authored-by: Alex Hansen <alex@alex-hansen.com>
kayagokalp pushed a commit that referenced this pull request Aug 3, 2023
Add nightly support for all packages
sdankel pushed a commit that referenced this pull request Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler General compiler. Should eventually become more specific as the issue is triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants