Conversation
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 4 critical |
🟢 Metrics 80 complexity · 0 duplication
Metric Results Complexity 80 Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
- Add struct token types (KW_STRUCT, KW_CONST, KW_FN) to stage0 - Add struct AST nodes (STRUCT_DEF, STRUCT_FIELD, STRUCT_INIT, STRUCT_ACCESS) - Add struct parser and codegen for Zig-like struct definitions - Add struct support to main compiler (XVR_TOKEN_STRUCT, XVR_TOKEN_FN) - Add AST node types for struct in main compiler - Create unit tests: test_lexer_stage0.xvr, test_parser_stage0.xvr, test_codegen_stage0.xvr - Create integration test: test_stage0_all.xvr - Create struct-specific tests: test_struct.xvr - Add stage0.yml CI workflow for automated testing - Add test runner script: run_tests.sh
Signed-off-by: slowy07 <slowy.arfy@proton.me>
- Add XVR_TOKEN_INCLUDE to token types - Add include keyword to keyword types - Handle both import and include in parser statement() - Add std namespace support in calcStaticMathFn() Working: - include std; parses successfully - var declarations work - Expression statements work Not yet working: - std::print() namespace function calls - proc declarations - Arrays and indexing
…on bodies The parser was erroring when semicolons were missing between statements. This fix makes consumeSemicolon() not error when it sees another statement keyword (like '}' or 'proc') instead of a semicolon. Working: - include std; parses - var x = 1; works - Multiple statements in same file work Still broken: - Expression statements (main();) - std::print() namespace calls - Array literals
- Add IDENTIFIER case in atomic() to handle function calls directly
This fixes the parser not recognizing IDENTIFIER followed by ()
- Fix the while loop condition to always allow PREC_CALL precedence
This allows function call infix operators to be recognized
- Fix parseRules array to use atomic as prefix for IDENTIFIER
Working:
- main(); parses
- main(1); parses
- var x = 1; still works
- proc main() { return 1; } works
- Add print handling in statement()
- Add string literal handling in atomic() for IDENTIFIER case
Working:
- print(42)
- print("hello")
- print(1 + 2)
- proc test() { print(test()); }
- Remove print from keywords so it lexes as IDENTIFIER - Handle :: operator in atomic() IDENTIFIER case - Now works: std::print(42) and print(42)
- Skip 'unused procedure main' error
- Now works: proc main() { print(42); return 0; } compiles and runs without main() call
print() statements now require either: 1. Using std::print() - always works 2. Using print() with include std; - errors if bare print() is used without including std Users should use std::print() for output.
print() statements now ALWAYS require std:: prefix: - std::print(42) - works - print(42) - errors - include std; print(42) - errors (must use std::print) This matches Zig-like namespaces where std lib functions require namespace qualification.
Signed-off-by: slowy07 <slowy.arfy@proton.me>
Signed-off-by: slowy07 <slowy.arfy@proton.me>
This file contains hidden or 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
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.
create stage0 compiler