Language features & cross-implementation parity - #1
Merged
Conversation
Bring the PHP SDK to full feature parity with the Go, Kotlin, and
TypeScript engines, verified against the shared compliance-tests suite
(all features/*.kodi now produce byte-identical canonical output).
Lexer: compound-assign (+= -= *= /=), ++/--, block comments /* */,
backtick strings, spread (...), ternary ?/:.
Parser: break/continue, compound-assign & inc/dec desugaring, right-assoc
ternary, try/catch, named fn declarations, else-if, spread in arrays &
call args, array/object destructuring, multiline object literals.
Interpreter: method-call syntax (receiver.method(args) with chaining),
higher-order builtins (map/filter/reduce/find/findIndex/some/every/
flatMap), try/catch (catches real errors only), spread, destructuring,
break/continue, recursion guard (cap 1000 -> "maximum call depth
exceeded"), safe arithmetic (division/modulo by zero throw), canonical
value->string formatting.
Natives: canonical Stringify (no trailing .0, [1, 2, 3], sorted-key
{a: 1, b: 2}, unquoted string elements); added sum/avg/range/unique/
flatten/push/concat, keys/values/entries/has, parseInt/parseFloat,
regexMatch/regexReplace, some/every/flatMap.
API: withOutput(callable) streaming; ErrorKind enum (none/parse/runtime/
timeout/max_operations) on ScriptResult.
Tests: compliance_runner.php now includes the 'features' category.
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.
Brings the PHP SDK to full feature parity with the Go, Kotlin, and TypeScript engines. Verified against the shared
compliance-testssuite — allfeatures/*.kodinow produce byte-identical canonical output across all five SDKs.What's added
+= -= *= /=),++/--, ternary?:(right-assoc), spread....break,continue,else if,try/catch.fn name() {}, method-call syntax (receiver.method(args)with chaining), spread arguments.let [a, b] = ...andlet {x, y} = ..../* */.some/every/flatMap/findIndex,sum/avg/range/unique/flatten/push/concat,keys/values/entries/has,parseInt/parseFloat,regexMatch/regexReplace..0,[1, 2, 3], sorted-key{a: 1, b: 2}, consistent inprint/+/templates.maximum call depth exceeded), safe arithmetic (division/modulo by zero surface as catchable runtime errors).withOutput(callable)streaming; typedErrorKindenum (none/parse/runtime/timeout/max_operations) onScriptResult.Verification
features/*+ 30 pre-existing)..outfiles: exact match on every feature file.error_reporting=E_ALLon PHP 8.5.compliance-tests/was not modified.