-
Notifications
You must be signed in to change notification settings - Fork 0
Fixes stack overflow and enhances container features #148
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
Changes from all commits
f1c325b
255b3b2
7f65226
fa01d62
96cae27
aa47a05
582174e
a942646
fb99a58
667bfb9
4e51de7
d1c3e63
f18d382
d34fc7b
b32c8b4
e4d0bd7
7e1bebc
d83925d
144a2b3
1ac1969
f2bcc9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Windows (MSVC toolchain) - 8MB stack | ||
| [target.'cfg(all(target_os = "windows", target_env = "msvc"))'] | ||
| rustflags = ["-C", "link-arg=/STACK:8388608"] | ||
|
|
||
| # Windows (GNU toolchain) - 8MB stack | ||
| [target.'cfg(all(target_os = "windows", target_env = "gnu"))'] | ||
| rustflags = ["-C", "link-arg=-Wl,--stack,8388608"] | ||
|
|
||
| # Linux - 8MB stack | ||
| [target.'cfg(target_os = "linux")'] | ||
| rustflags = ["-C", "link-arg=-Wl,-z,stack-size=8388608"] | ||
|
|
||
| # macOS - 8MB stack | ||
| [target.'cfg(target_os = "macos")'] | ||
| rustflags = ["-C", "link-arg=-Wl,-stack_size,0x800000"] | ||
|
|
||
| # FreeBSD and other Unix-like systems - 8MB stack | ||
| [target.'cfg(all(unix, not(any(target_os = "macos", target_os = "linux"))))'] | ||
| rustflags = ["-C", "link-arg=-Wl,-z,stack-size=8388608"] | ||
|
Comment on lines
+17
to
+19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Overbroad “unix but not macOS/Linux” block passes ELF flags to non-ELF targets (iOS, etc.) This cfg matches iOS, Android, and other Unix-family targets. -z,stack-size is an ELF linker flag and is invalid for Mach-O (iOS), which will fail linking. Even on BSDs, support depends on using lld and may still be undesirable. Apply: -# FreeBSD and other Unix-like systems - 8MB stack
-[target.'cfg(all(unix, not(any(target_os = "macos", target_os = "linux"))))']
-rustflags = ["-C", "link-arg=-Wl,-z,stack-size=8388608"]If you specifically want to experiment on FreeBSD with lld, gate narrowly and be prepared to revert: # FreeBSD (lld) — use with caution; may be ignored or undesirable
[target.'cfg(target_os = "freebsd")']
rustflags = ["-C", "link-arg=-Wl,-z,stack-size=8388608"]🤖 Prompt for AI Agents |
||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Minimal test case to reproduce container parsing issues | ||
| // This file should fail to parse initially, then pass after fixes | ||
|
|
||
| create container SimpleTest: | ||
| property name: Text | ||
|
|
||
| action greet: | ||
| display "Hello" | ||
| end | ||
|
|
||
| action set_name needs new_name: Text: | ||
| store name as new_name | ||
| end | ||
| end | ||
|
|
||
| create new SimpleTest as test: | ||
| name is "Test" | ||
| end | ||
|
|
||
| test.greet() | ||
| test.set_name("Fixed") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| AST output for: TestPrograms/container_parsing_test.wfl | ||
| ============================================== | ||
|
|
||
| Program with 4 statements: | ||
|
|
||
| Statement #1: ContainerDefinition { | ||
| name: "SimpleTest", | ||
| extends: None, | ||
| implements: [], | ||
| properties: [ | ||
| PropertyDefinition { | ||
| name: "name", | ||
| property_type: Some( | ||
| Text, | ||
| ), | ||
| default_value: None, | ||
| validation_rules: [], | ||
| visibility: Public, | ||
| is_static: false, | ||
| line: 5, | ||
| column: 5, | ||
| }, | ||
| ], | ||
| methods: [ | ||
| ActionDefinition { | ||
| name: "greet", | ||
| parameters: [], | ||
| body: [ | ||
| DisplayStatement { | ||
| value: Literal( | ||
| String( | ||
| "Hello", | ||
| ), | ||
| 8, | ||
| 17, | ||
| ), | ||
| line: 9, | ||
| column: 5, | ||
| }, | ||
| ], | ||
| return_type: None, | ||
| line: 0, | ||
| column: 0, | ||
| }, | ||
| ActionDefinition { | ||
| name: "set_name", | ||
| parameters: [ | ||
| Parameter { | ||
| name: "new_name", | ||
| param_type: Some( | ||
| Text, | ||
| ), | ||
| default_value: None, | ||
| line: 11, | ||
| column: 27, | ||
| }, | ||
| ], | ||
| body: [ | ||
| VariableDeclaration { | ||
| name: "name", | ||
| value: Variable( | ||
| "new_name", | ||
| 12, | ||
| 23, | ||
| ), | ||
| is_constant: false, | ||
| line: 12, | ||
| column: 9, | ||
| }, | ||
| ], | ||
| return_type: None, | ||
| line: 0, | ||
| column: 0, | ||
| }, | ||
| ], | ||
| events: [], | ||
| static_properties: [], | ||
| static_methods: [], | ||
| line: 4, | ||
| column: 1, | ||
| } | ||
|
|
||
| Statement #2: ContainerInstantiation { | ||
| container_type: "SimpleTest", | ||
| instance_name: "test", | ||
| arguments: [], | ||
| property_initializers: [ | ||
| PropertyInitializer { | ||
| name: "name", | ||
| value: Literal( | ||
| String( | ||
| "Test", | ||
| ), | ||
| 17, | ||
| 13, | ||
| ), | ||
| line: 17, | ||
| column: 5, | ||
| }, | ||
| ], | ||
| line: 16, | ||
| column: 1, | ||
| } | ||
|
|
||
| Statement #3: ExpressionStatement { | ||
| expression: MethodCall { | ||
| object: Variable( | ||
| "test", | ||
| 20, | ||
| 1, | ||
| ), | ||
| method: "greet", | ||
| arguments: [], | ||
| line: 20, | ||
| column: 1, | ||
| }, | ||
| line: 21, | ||
| column: 1, | ||
| } | ||
|
|
||
| Statement #4: ExpressionStatement { | ||
| expression: MethodCall { | ||
| object: Variable( | ||
| "test", | ||
| 21, | ||
| 1, | ||
| ), | ||
| method: "set_name", | ||
| arguments: [ | ||
| Argument { | ||
| name: None, | ||
| value: Literal( | ||
| String( | ||
| "Fixed", | ||
| ), | ||
| 21, | ||
| 15, | ||
| ), | ||
| }, | ||
| ], | ||
| line: 21, | ||
| column: 1, | ||
| }, | ||
| line: 0, | ||
| column: 0, | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // Test for container property access in methods | ||
| create container Person: | ||
| property name: Text | ||
|
|
||
| action get_name: | ||
| return name | ||
| end | ||
| end | ||
|
|
||
| create new Person as alice: | ||
| name is "Alice" | ||
| end | ||
|
|
||
| store result as alice.get_name() | ||
| display result |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| AST output for: TestPrograms/container_property_access_test.wfl | ||
| ============================================== | ||
|
|
||
| Program with 4 statements: | ||
|
|
||
| Statement #1: ContainerDefinition { | ||
| name: "Person", | ||
| extends: None, | ||
| implements: [], | ||
| properties: [ | ||
| PropertyDefinition { | ||
| name: "name", | ||
| property_type: Some( | ||
| Text, | ||
| ), | ||
| default_value: None, | ||
| validation_rules: [], | ||
| visibility: Public, | ||
| is_static: false, | ||
| line: 3, | ||
| column: 5, | ||
| }, | ||
| ], | ||
| methods: [ | ||
| ActionDefinition { | ||
| name: "get_name", | ||
| parameters: [], | ||
| body: [ | ||
| ExpressionStatement { | ||
| expression: Variable( | ||
| "Text", | ||
| 5, | ||
| 22, | ||
| ), | ||
| line: 6, | ||
| column: 9, | ||
| }, | ||
|
Comment on lines
+29
to
+37
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent AST structure for method body. The AST shows an This AST structure suggests a parsing issue where the return type syntax may not be correctly handled. The
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @claude can you investigate this and see if any action needs to be taken here?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Claude finished @logbie's task —— View job Investigating AST Structure IssueCodeRabbit flagged a potential parsing issue in the AST file. I've completed my investigation: Todo List:
🐛 Critical Parser Bug IdentifiedRoot Cause:The issue is in
This causes the parser to get out of sync with the token stream. Evidence:The AST shows But it appears in the method body at line 6, column 9 - indicating token stream corruption. The Fix Required:In } else {
- self.expect_token(Token::Colon, "Expected ':' after action declaration")?;
None
};Impact:
📋 Recommendation:Action Required - This is a legitimate parsing bug that should be fixed to prevent AST corruption and potential parsing failures in more complex scenarios. |
||
| ReturnStatement { | ||
| value: Some( | ||
| Variable( | ||
| "name", | ||
| 6, | ||
| 16, | ||
| ), | ||
| ), | ||
| line: 6, | ||
| column: 9, | ||
| }, | ||
| ], | ||
| return_type: None, | ||
| line: 0, | ||
| column: 0, | ||
| }, | ||
| ], | ||
| events: [], | ||
| static_properties: [], | ||
| static_methods: [], | ||
| line: 2, | ||
| column: 1, | ||
| } | ||
|
|
||
| Statement #2: ContainerInstantiation { | ||
| container_type: "Person", | ||
| instance_name: "alice", | ||
| arguments: [], | ||
| property_initializers: [ | ||
| PropertyInitializer { | ||
| name: "name", | ||
| value: Literal( | ||
| String( | ||
| "Alice", | ||
| ), | ||
| 11, | ||
| 13, | ||
| ), | ||
| line: 11, | ||
| column: 5, | ||
| }, | ||
| ], | ||
| line: 10, | ||
| column: 1, | ||
| } | ||
|
|
||
| Statement #3: VariableDeclaration { | ||
| name: "result", | ||
| value: MethodCall { | ||
| object: Variable( | ||
| "alice", | ||
| 14, | ||
| 17, | ||
| ), | ||
| method: "get_name", | ||
| arguments: [], | ||
| line: 14, | ||
| column: 17, | ||
| }, | ||
| is_constant: false, | ||
| line: 14, | ||
| column: 1, | ||
| } | ||
|
|
||
| Statement #4: DisplayStatement { | ||
| value: Variable( | ||
| "result", | ||
| 15, | ||
| 9, | ||
| ), | ||
| line: 15, | ||
| column: 9, | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Recommended approach for Unix-like platforms: avoid link-time stack sizing; use runtime/system knobs
Would you like a small main.rs helper that raises RLIMIT_STACK at startup on Unix platforms (behind a cfg(unix) + libc dep) and uses thread::Builder for worker threads?
🤖 Prompt for AI Agents