This document describes the known issues and limitations that remain as xfail tests in the microjs implementation.
Tests affected:
test_deep_nested_parens✅ Now passingtest_deep_nested_braces✅ Now passingtest_deep_nested_arrays✅ Now passingtest_deep_nested_regex_groups(regex parser, still xfail)test_large_eval_parse_stack✅ Now passing
Solution implemented: Converted key parsing paths to use iterative approaches with explicit stacks:
-
Parser changes (
parser.py):- Consecutive parentheses
((((1))))are now handled iteratively - Nested array literals
[[[[1]]]]use a stack-based approach - Block statements
{{{{1;}}}}are parsed iteratively - Added
_parse_block_statement_iterative()and_parse_nested_arrays()methods - Added
_continue_parsing_expression()for handling operators between nested parens
- Consecutive parentheses
-
Compiler changes (
compiler.py):MemberExpressionchains are compiled iteratively (for deepa[0][0][0]...)ArrayExpressioncompilation uses a work stack instead of recursionBlockStatementcompilation is iterative_compile_statement_for_value()drills through nested blocks iteratively
Inspiration: The approach was inspired by mquickjs's continuation-passing style parser, though we use a simpler Python-friendly stack-based approach rather than the full CPS transformation.
Remaining issue:
- Regex parser (
regex/parser.py) still uses recursion for nested groups - This affects
test_deep_nested_regex_groups
Tests affected:
test_error_constructor_has_line_numbertest_error_constructor_has_column_number
Problem:
When creating an Error object with new Error("message"), the lineNumber and columnNumber properties should indicate where the Error was constructed. Currently they are None until the error is thrown.
Root cause:
The Error constructor is a Python function that doesn't have access to the VM's current source location. Only the _throw method in the VM sets line/column from the source map.
Implemented behavior:
- Thrown errors (
throw new Error(...)) correctly get lineNumber/columnNumber from the throw statement location - Constructed but not thrown errors have
Nonefor these properties
Potential solutions:
- Pass a callback to the Error constructor that retrieves the current VM source location
- Make Error construction go through a special VM opcode that captures location
- Use Python stack introspection to find the calling location (hacky)
Complexity: Medium - requires threading location info through constructor calls
Tests affected:
test_regexp(from test_builtin.js)test_mquickjs_js[test_builtin.js]test_mquickjs_js[microbench.js]
Problem: The comprehensive regex test suites from the original QuickJS contain tests that exercise edge cases not fully implemented.
Known issues that were fixed:
- Capture group reset in repetitions
- Empty alternative in repetition
- Surrogate pair handling in unicode mode
- Backspace escape in string literals
Remaining issues:
- Some edge cases with lookahead captures in optional groups
- Possible issues with complex backreference scenarios
- Unicode property escapes (if used in tests)
Complexity: Varies per issue
| Category | Issue Count | Status |
|---|---|---|
| Deep nesting/recursion | 5 → 1 | ✅ Mostly resolved |
| Error location tracking | 2 | Medium complexity |
| Lookahead capture semantics | 2 | High complexity |
| Comprehensive test suites | 4 | Varies |
Total xfail tests: 10 (down from 14)
Most remaining issues fall into two categories:
- Spec edge cases (lookahead captures) - require careful ECMAScript spec analysis
- Location tracking - requires threading location info through constructor calls
Resolved:
- Deep nesting for parentheses, arrays, and block statements now works with 1000+ levels