-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add WFL to JavaScript transpiler #262
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c4eb369
feat: Add WFL to JavaScript transpiler
claude 91b0fce
Security fixes and transpiler improvements
claude[bot] dff82e4
Fix formatting and security issues in transpiler
claude[bot] 506cf9b
Merge main branch to resolve conflicts
devin-ai-integration[bot] 0099be1
fix: Apply cargo fmt formatting
devin-ai-integration[bot] a30e474
fix: Handle new test statement types and fix clippy warnings
devin-ai-integration[bot] 22ff497
fix: Rename test variables to avoid reserved keywords
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| // Example WFL program to demonstrate the JavaScript transpiler | ||
| // Run: wfl --transpile TestPrograms/transpiler_example.wfl | ||
|
|
||
| display "=== WFL to JavaScript Transpiler Demo ===" | ||
| display "" | ||
|
|
||
| // Variable declarations | ||
| store greeting as "Hello" | ||
| store counter as 0 | ||
| store is_active as yes | ||
|
|
||
| // Action (function) definition | ||
| define action called add_numbers with parameters a and b: | ||
| return a plus b | ||
| end action | ||
|
|
||
| // Action with display | ||
| define action called greet_user with parameter name: | ||
| display "Welcome, " with name with "!" | ||
| end action | ||
|
|
||
| // Main entry point | ||
| define action called main: | ||
| display "Starting program..." | ||
|
|
||
| // Using variables | ||
| display "Greeting: " with greeting | ||
| display "Counter: " with counter | ||
| display "Active: " with is_active | ||
|
|
||
| // Calling actions | ||
| store result as add_numbers with 5 and 10 | ||
| display "5 + 10 = " with result | ||
|
|
||
| greet_user with "Alice" | ||
|
|
||
| // Conditional logic | ||
| check if is_active: | ||
| display "System is active" | ||
| otherwise: | ||
| display "System is inactive" | ||
| end check | ||
|
|
||
| // Count loop | ||
| display "Counting from 1 to 5:" | ||
| count from 1 to 5: | ||
| display " Count: " with count | ||
| end count | ||
|
|
||
| // List operations | ||
| create list colors: | ||
| add "red" | ||
| add "green" | ||
| add "blue" | ||
| end list | ||
|
|
||
| display "Colors:" | ||
| for each color in colors: | ||
| display " - " with color | ||
| end for | ||
|
|
||
| // Nested conditions | ||
| store score as 85 | ||
| check if score is greater than 90: | ||
| display "Grade: A" | ||
| otherwise: | ||
| check if score is greater than 80: | ||
| display "Grade: B" | ||
| otherwise: | ||
| display "Grade: C" | ||
| end check | ||
| end check | ||
|
|
||
| display "" | ||
| display "=== Demo Complete ===" | ||
| end action |
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
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
Oops, something went wrong.
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.
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.
Error message lacks context about which file failed to write. Include the output_file path to help users identify the problem.