-
Notifications
You must be signed in to change notification settings - Fork 2
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
Remake of the parser #58
Merged
Merged
Conversation
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
…and can now get the logs vector
…g and add extend the prelude
-> unterminated quote literal errors now show correctly the faulty error code -> renamed the 'location' method of LogContext to 'line_col' because before it didn't make sense
With the new error system and the remake of the parser, the old error system is useless. So I removed it.
Some method have been renamed, 'add' into 'push' and 'add_raw' into 'push_raw' because it didn't make sense. And creation of the LogStream type.
After removing the old parser, their is the new parser with the new error system. It is intended to be simpler than it's predecessor.
Before you could simply return 'Error' and without ever pushing the error, now you return the error(s) of the lexing functions.
While remaking the parser, I redid the language's grammar. Their is 3 new keywords 'package', 'import', and 'as'. Now a source file must contain a package clause, and maybe some import declarations. I also added some methods to types, and changed the ParsingResult type.
…Parse trait Before the macro was just looking for a "parse" method but now the macro explicitly call the "parse" method of the "Parse" trait.
…tion Back quotes were added because in error message seeing { without quotes maybe confusing and so for consistency used back quotes: `.
It is used in error messages when an unexpected token was found, instead of saying e.g: "found char literal, expected identifier, keyword `fn` or comma", say "found char literal, expected expression". It's shorter and easier for the user to understand.
Before it only checks if the EOF token was poped now it checks if the EOF has been poped or the last token is EOF.
Allowed `unreacheable_code` and `unused_variable` in expect_token! macro because we may use a noreturn expression as $result.
Closed
21 tasks
Can now accumulate multiples calling expr, member accesses and bin operations (in some not covered cases).
7 tasks
…s own parsing function
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the new log system, I'm remaking the parser, because the old one is old and crapy and I want to change the grammar of the language so kill two birds with one stone.
TODO:
note
andhelp
to be able to point to codeparse_parenthesized_expr
, add a note about the expected closing partenthesis to point to the opening one.undefined expr-> see unresolved questionsa + b
-> Operator precedence parser-a
,!a
,&a
, anda.*
a if predicate else b
$IdentifierList := $ExprList
i++
,i--
,++i
and--i
-> will potentialy be done later, the question hasn't yet been resolvedzom_common::token
in its own moduleUnresolved questions
undefined
expression ? With the new path Zom is taking, the path of simplicity, should instead allow variable declaration with the expr optional :const test: u32
?-> We allow to define a variable without initializing its expression, and we remove the 'undefined' expression, and keyword.
:=
its own operator?-> Will not be answered here / now.
a ++ b
, what do we do?-> Will not be answered here / now.