You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(ovsm): add C-style brace syntax support for control flow
Added support for C-style braces alongside existing Python-style syntax,
allowing users to choose their preferred coding style:
Python-style (colon + indentation):
FOR $i IN [1..10]:
$sum = $sum + $i
RETURN $sum
C-style (braces + semicolons):
FOR $i IN [1..10] { $sum = $sum + $i; }
RETURN $sum
Changes:
- Modified FOR loop parser to accept either ':' or '{' after iterable
- Modified WHILE loop parser to accept either ':' or '{' after condition
- Modified IF/ELSE parser to accept either 'THEN' or '{' after condition
- Updated error messages to reflect both syntax styles
- Semicolons already worked as statement separators
- Both styles can be mixed in the same script
- Backward compatible - all existing Python-style code works
Tests verified:
✅ C-style FOR loops with single and multiple statements
✅ C-style WHILE loops
✅ C-style IF/ELSE statements
✅ Nested C-style loops
✅ Mixed Python/C style in same script
✅ Complex nested conditionals
✅ Python-style syntax still works perfectly
This makes OVSM more approachable for developers from C/Java/JavaScript
backgrounds while maintaining full Python-style support.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
Copy file name to clipboardExpand all lines: src/services/ovsm_service.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -78,7 +78,7 @@ impl OvsmService {
78
78
let result = self
79
79
.evaluator
80
80
.execute(&program)
81
-
.context("Failed to execute OVSM program. Note: OVSM requires proper indentation (like Python). Single-line colon syntax is not supported for loops.")?;
81
+
.context("Failed to execute OVSM program. Note: OVSM supports both Python-style (colon + indentation) and C-style (braces) syntax for control flow.")?;
0 commit comments