All notable changes to Coderive are documented in this file.
- Renamed void early-return keyword from
exittofinthroughout the language. TokenType.Keyword.EXITrenamed toTokenType.Keyword.FIN.- AST node
Exitrenamed toFin; exceptionEarlyExitExceptionrenamed toEarlyFinException. - IR serialization tag updated from
"Exit"to"Fin"(no backward compatibility required; pre-release). - All parser, printer, lowerer, and visitor references updated accordingly.
- Removed
continue→skipandreturn→fincompatibility aliases fromIdentifierLexer. - Only explicit
skipandfinkeywords are now recognized as control-flow statements.
- Updated all
.coddemo and standard-library files to usefininstead ofexit/returnandskipinstead ofcontinue:std/json/Json.codstd/scimath/SciMath.coddemo/src/main/test/controlflow/ControlFlow.coddemo/src/main/test/json/JsonStandardLibraryComprehensive.cod
- Fixed
CodPTACParityRunnernormalize function to handle timing output of the form"... at <N> ms"(fixesBMark.codparity mismatch). - Verified Java 7 source/target compatibility; all sources compile cleanly with
-source 1.7 -target 1.7. - All parity tests pass after keyword migration.
- Baseline (naive O(n²)):
~1280 msforprimeCount(5000)on PTAC executor. - Optimized
primeCountinBMark.cod: skip even candidates after 2, iterate odd divisors only (step 2), and break early whendivisor * divisor > candidate(√n bound). - Expected speedup: ~8–15× over naive O(n²) for
primeCount(5000).
- Moved
src/main/cod/→src/cod/;src/main/now holds only Java implementations. - Updated
TestRunner,CodPTACParityRunner, andIRValidationRunnerhardcoded Android/console paths accordingly. - Removed root
examples/directory; demo programs live insrc/cod/demo/src/main/test/. - Moved
benchmarks/,drafts/, andsuggestions/into a newmisc/folder. - Updated README: version badge → 0.9.6, Examples → Demo Programs section, all path references refreshed.
- Renamed
source_.jar→source_.zip; archive now containscod/andsrc/main/at the same level. - Updated
build.gradle(sourceJartask →sourceZipZip task) and GitHub Actions workflow.
- Fixed JSON text parsing to correctly handle valid quoted strings and escape sequences without falling into false
unterminated texterrors. - Hardened object key/value handling for empty-object paths in
JsonValue.set(...),JsonValue.has(...), andJsonValue.getKey(...). - Corrected unicode
\uXXXXformatting internals in JSON serialization to avoid type/runtime mismatches in escape generation. - Fixed JSON text escaping so regular letters (such as
b/f) are preserved and only real control characters are escaped.
- Restored full
JsonStandardLibraryComprehensive.codassertions (text, object, round-trip, unicode, invalid-case coverage). - Verified direct
CommandRunnerexecution for the JSON comprehensive suite now passes. - Re-validated demo parity suite (
CodPTACParityRunner) after JSON fixes.
- Added a dedicated cross-language lexer/parser throughput suite under
benchmarks/lexer_parser/. - New runner:
bash benchmarks/lexer_parser/run_lexer_parser_benchmark.sh <runs> <iterations>. - Current baseline (run:
5medians,1000iterations):
| Language | Median ms | Throughput MB/s |
|---|---|---|
| Coderive | 632 | 2.22 |
| Java | 111 | 12.61 |
| Go | 17 | 82.35 |
| Kotlin | 162 | 8.64 |
| Python | 270 | 5.19 |
| Lua | 228 | 6.14 |
- Parser construction/validation overhead is dominant in Coderive relative to pure scanner+light-parser baselines.
- Tokenizer object churn remains significant (token allocation and parser handoff pressure).
- Near-term focus:
- add a lexer-only throughput mode in Coderive benchmarks to isolate lexing cost from parse cost,
- reduce parser backtracking/rewind-heavy paths in
MainParserdeclaration probing, - introduce low-allocation token-stream views for parser hot paths.
- Linear recurrence refactor/composition and v0.8.4 version alignment — recurrence formula refactor/composition updates and version alignment work.
- Rolling/vector recurrence execution improvements — rolling/vector linear recurrence execution upgrades and related parity-path updates.
.codccontainer write/read hardening — custom zip-container behavior and container stability improvements.- Shared index consolidation in project container root — import index consolidation into project container root entry (
HOOK.toml). - Unit-path structure fixes and deterministic lowering reset —
.codb/.codcpath structure fixes plus deterministic PTAC lowering counter reset behavior. CommandRunnerfull compile mode and summary polish —-f/--fullsupport and compile summary output improvements.- Borrow-check enforcement for unsafe indexed mutation — borrow safety checks extended into unsafe indexed mutation paths.
- Active-borrow tracking performance upgrades — zero-cost/O(1) active-borrow tracking improvements.
- Unsafe operation boundary model implementation —
unsafeclass/method modifier support with enforcedsafe(...)wrapping for calling unsafe operations from safe contexts (direct safe-context calls are rejected).
- Unsafe declaration ordering enforced — Unsafe declarations require explicit visibility before
unsafe(share unsafe ...orlocal unsafe ...).
Migration example:unsafe share MyType { ... }→share unsafe MyType { ... }. - Unsafe operation boundary model enforced —
unsafeis supported as a class/method modifier, and unsafe constructors/methods must be wrapped withsafe(...)when called from safe contexts.safe(...)is not allowed inside unsafe contexts. - Borrow checks tightened in unsafe mutation paths — Unsafe indexed mutation now participates in borrow-safety enforcement.
- Unsafe pointer model added — Unsafe contexts support pointer-oriented syntax/runtime behavior (
*<unsafe-type>,<unsafe-type>[n],&,*, and pointer arithmetic with bounds checks). - Full-project compile mode in CLI —
CommandRunnersupports-f/--fullto compile all.codfiles undersrc/main. - O(1) borrow checking via active-borrow tracking — Borrow-state checking moved from scan-based checks to O(1)-style active tracking for lower runtime overhead.
- Deterministic lowering register naming — PTAC lowering counters reset per
lower()call to keep generated naming stable per artifact. - IR path normalization for dotted units — Dotted unit names are normalized into slash paths for both
.codcentries and standalone.codbfallback lookup. - Project-level index container — Shared index data is stored in
src/bin/project.codcat root entryHOOK.toml. - Container format and write hardening —
.codccontainer behavior was tightened with stronger write/cleanup semantics and stable zip-container handling. - Standalone
.codbsupport retained — Standalone.codbartifacts remain a permanent supported format alongside.codcgrouping.
- Conditional formula composition in
NaturalArray— Conditional formulas compose into a single merged formula path. - Linear recurrence composition and rolling/vector execution upgrades — Recurrence paths were refactored for better composition, lower memory pressure, and improved recurrence execution behavior.
- Lazy map/filter chaining composition — LiteralRegistry composes chained lazy map/filter views to reduce wrapper layering.
- LinearRecurrenceFormula moved to constant-space evaluation — Removed range-sized recurrence precomputation tables so recurrence evaluation no longer allocates memory proportional to covered range size.
- Linear recurrence composition in NaturalArray —
addLinearRecurrenceFormula(...)now composes newly added formulas with existing recurrence formulas (newer-over-older), mirroring the optimized conditional formula path. - Recurrence lookup cache cleanup — Removed per-index recurrence-formula index caching to avoid linear growth of recurrence metadata with random index access.
- Version bump to v0.8.0 — Updated repository and documentation versioning for the Fancy Machine release.
- Comprehensive language specification — Added detailed documentation coverage for keywords, symbols/operators, syntax forms, and runtime behavior.
- Documentation page upgrades — Added a specification-focused section and integrated client-side documentation search.
- Custom spec branding asset — Added a custom spec logo generated via Python for the Documentation page.
- Wiki/discussion publication prep — Added wiki-ready specification markdown and discussion announcement draft files for direct publishing.
- Browser runtime migration — Replaced the CheerpJ-based playground path with a pure JavaScript Coderive runtime for faster startup and no Java boot delay in the web playground.
- Playground loading UX improvements — Added a clearer multi-step loading flow and earlier runtime preloading to improve perceived responsiveness.
- Repository automation updates — Added workflow support for source jar refresh and branch-cleanup automation updates.
- Text literal handling fixes — Corrected text literal extraction paths and cleaned related parser debug noise.
- Decimal output formatting improvements — Improved numeric formatting consistency for decimal output.
- Param skip and test/runtime polish — Follow-up fixes for parameter skip behavior and associated runtime/testing paths.
- Ran existing Gradle test task (
./gradlew test) successfully. - Ran unit
.codfiles undersrc/main/cod/src/main/test/withCommandRunner; current repo still has pre-existing issues in some interactive/import/broadcast test files (for example:Broadcast.cod,Import.cod,Interactive.cod,Parity.cod) that are not introduced by this release-note update.
for...inreplaced withfor...of— Loop iteration keyword changed fromintooffor clarity and consistency (for i of 1 to 5). All existing loop code must be updated.- Loop step clause reordered — The
byclause now follows the range specification:for i of start to end by steps(previouslyfor i by steps in start to end). in()prompt argument added — Input method now accepts an optional type and prompt string directly:in(text, "Enter name: ")replaces the previousouts("Enter name: ")+in()pattern.- Token class redesigned — Multiple overloaded constructors replaced with static factory methods; a
keywordfield is now embedded directly on theTokenobject instead of being derived at parse time. cod.compilerpackage removed — The entire native compiler pipeline (TAC, MTOT) has been deleted. Coderive is now an interpreter-only language runtime.
- Output-Aware Loop Optimization — New
OutputAwarePatterndetects loops containing I/O statements and applies dedicated optimizations, significantly improving performance for mixed-output loops. IntroducedOutputAwarePatternandSequencePatternas the primary range execution strategies. - LiteralRegistry — Introduced an extension system that enables property access and method calls directly on literal values (ranges, numbers, strings, arrays). Provides a clean, pluggable API for built-in literal behaviors such as
.size,.contains(), and more. - PolicyResolver with Caching — Dedicated resolver for enforcing Policy type virality. Uses per-policy caches for O(1) method-requirement lookups, composition chains, and per-class validation results, replacing ad-hoc policy checks scattered across the interpreter.
- Web Documentation & Playground Site — Added a complete
docs/single-page application with a home page, documentation browser, and an in-browser interactive Coderive playground. - SlotParser — Extracted return-slot (
::) parsing fromMainParserinto a dedicatedSlotParserclass for improved separation of concerns and maintainability. - Inline Range Formula Shorthand — New concise syntax for range formulas:
1..32#*2(equivalent to a multiplicative range from 1 to 32 doubling each step) alongside the existingfor i of 1 to 32 by *2form.
- Lexer Modularization — Decomposed the monolithic
MainLexerinto six focused sub-lexers:CommentLexer,IdentifierLexer,NumberLexer,StringLexer,SymbolLexer, andWhitespaceLexer, each responsible for a single token category. - Interpreter Handler Unification — All handler classes (
AssignmentHandler,ExpressionHandler,TypeHandler,IOHandler) consolidated under thecod.interpreter.handlerpackage.TypeSystemandTypeValuemerged intoTypeHandler, eliminating a separatecod.interpreter.typepackage. - Keyword Lookup Optimization — Added
Keyword.fromString()backed by a pre-builtHashMapfor O(1) keyword resolution, replacing linear enum scans. - Slot Access Optimization in
ExecutionContext— Return slot storage now uses parallel arrays (slotNamesList,slotValuesList,slotTypesList) with an index map for O(1) slot reads and writes. - New Utility Classes —
ObjectCheckerfor reusable null/type validation andTokenSkipperfor efficient token-stream navigation, reducing boilerplate throughout the parser and interpreter. InternalError— New dedicated error class for interpreter-internal assertion failures, distinct from user-facingProgramError.
SequenceFormulareplaces bothMultiBranchFormulaandLoopFormulaas the primary formula type for sequential range evaluation, reducing formula class count and improving composability.OutputAwarePatternandSequencePatternadded as new execution-aware range patterns.AssignmentPatternremoved.NaturalArrayoverhauled — Significant internal rewrite for correctness, better interaction with the new pattern/formula architecture, and improved lazy evaluation behaviour.
- Compiler Pipeline — The entire
cod.compilerpackage deleted:TACCompiler,MTOTNativeCompiler,GraphColoringAllocator,LivenessAnalyzer,RegisterManager,BasicBlock,TACInstruction,TACProgram, andMTOTRegistry. - C Runtime —
src/main/c/runtime.cremoved; native compilation is no longer a supported target. - Legacy Runner Classes —
CompilerRunner,CompilerTestRunner, andInterpreterRunnerfully removed after their replacements (TestRunner,CommandRunner) were stabilized in v0.6.0. cod.parser.programPackage —ProgramTypeandProgramTypeScannerremoved; their functionality has been absorbed into other components.TokenValidator— Dedicated semantic token-validation class removed after its responsibilities were redistributed.
- Coderive Docs Website — New
docs/directory containing a full SPA: router, home page, documentation viewer, interactive playground, and shared CSS/JS modules. PlaygroundServer.javaUpdated — Improved request handling and API compatibility for the hosted playground.- Demo Files Updated —
InteractiveDemo.codandLazyLoop.codrevised to reflect newfor...ofloop syntax and updatedin()prompt API. - New Test File — Added
LoopWithIOTest.codto exercise and validate the output-aware loop optimization path.
- Replaced out/in methods -
outln()→out()(auto-newline per arg),out()→outs()(auto-spacing between args). - Removed ambiguous method chain syntax - Eliminated
method(any[ args...])andmethod(all[args...])syntax as chaining methods, keeping onlyany[]/all[]array forms for clarity and consistency. - Removed Builtin I/O methods -
out(),outln(), andin()removed from BuiltinRegistry, now only accessible globally via GlobalRegistry. - Project structure standardization - Moved to
src/main/project structure for cleaner organization and standardized imports.
thisandsuperKeywords - Fully integrated as object pointers for class instance referencing and parent class access.- Policy Type with Virality - Introduced Policy type where implementation forces all children (even far descendants) to implement the same Policy.
- Enhanced I/O Methods -
out(): Supports consecutive multi-argument output with auto-newline after each argumentouts(): Successive output with automatic spacing between arguments
- SourceSpan Integration - New SourceSpan class for improved line/column handling in error messages and incremental parsing.
- Parser Refactoring - Replaced PositionHolder with proper ParserContext, added ParserState and ParserResult for better maintainability and performance.
- Expect Pattern - Introduced
expect()pattern for consistent token consumption, fixing "forgot to consume" issues. - InterpreterVisitor Modularization - Refactored into separate helper classes for cleaner architecture.
- Program Type Scanning - Separated ProgramTypeScanner from MainParser for dedicated program type analysis.
- Multiline String Fix - Fixed baseline handling to use aligned opening/closing delimiters and auto-strip leading whitespace.
- Package Restructuring -
- ParseResult, ParserContext, ParserState →
cod.parser.context - ProgramType and ProgramTypeScanner →
cod.parser.program
- ParseResult, ParserContext, ParserState →
- Class Renaming -
InterpreterRunner→TestRunnerCompilerRunner→CompilerTestRunner
- Token Validation - Introduced TokenValidator for dedicated enum validation.
- Demo File Reorganization - Moved demo files to follow
src/main/structure. - Fixed Main Broadcasting - Fully repaired broken
main()broadcasting feature.
- Removed Unused Components - Eliminated unused
Sys.codfile. - Standardized Project Layout - Adopted conventional
src/main/directory structure.
- Heavy package restructuring - Multiple classes moved to new packages for better organization.
- Renamed core classes -
ASTVisitor→VisitorImpl,BaseASTVisitor→ASTVisitor,TypedValue→TypeValue,CoderiveREPL→REPLRunner. - Removed optimization components - Eliminated
ConstantFolder,Deadcode eliminator, and associated helper methods.
- Enhanced Formula Loops - Added support for combinations of patterns at the top level.
- Multi-line String Support - Introduced
|"and"|delimiter pair for multi-line strings with baseline-aware content alignment (different from traditional"""triple quotes). - Package Private Classes - Added support for package-private class visibility.
- Package Broadcasted main() - Added main method broadcasting at package level with call restrictions.
- Native Range Indexing - Added native range index feature for arrays.
- Builtin Timer Method - Added
timer()method accessible both as builtin and globally.
- Enhanced MainLexer - Made more modular and maintainable.
- Project Restructuring - Heavy reformatting and repackaging of entire codebase:
- Moved
ExecutionContextandObjectInstancetointerpreter.context - Moved
BreakLoopException,EarlyExitException,SkipIterationExceptiontointerpreter.exception - Moved
IOHandlertointerpreter.io - Moved
BuiltinRegistryandGlobalRegistrytointerpreter.registry - Moved
TypeSystemandTypeValuetointerpreter.type - Moved
NaturalArrayto dedicatedrangepackage - Moved formula classes to
range.formula - Moved pattern classes to
range.pattern
- Moved
- Performance Improvements - Fixed subtle bugs to enhance overall performance.
- Cleaner Codebase Structure - Logical separation of concerns with dedicated packages for exceptions, IO, registries, types, and range handling.
- Improved Maintainability - Modular lexer and better organized class hierarchy.
- Dedicated Range Package - Centralized range and pattern handling functionality.
- Removed
inputandoutputkeywords - Replaced with method callsSys.in(...)andSys.out(...).
- Class Inheritance - Added class inheritance with the
iskeyword. - Class Constructors - Added class constructors using
thisas a special method name. - Class Calling - Added support for direct class calling.
- Flexible Control Flows - Enhanced control flow structures to be more flexible while maintaining safety.
- Enhanced Loop Safety - Added checks to prevent loop steps of 0 and ensure loops do not reverse from their stated start and end direction.
- External Array Iteration - Added support for iterating over external arrays within loops.
- Builtin Method Syntax - Removed the requirement for
{}bodies for builtin methods. - Dedicated Registry Classes - Added separate Registry classes for Builtin and Global methods.
- Global I/O Methods - Added
in()andout()as both Builtin and Global methods for accessibility.
- Fixed BinaryOpNode Bug - Resolved a deeply hidden bug in the BinaryOpNode.
- Optimized Array Iteration - Added formula-based loops for O(1) iteration over natural arrays.
- Proper Code Instantiation - Fixed issues related to code instantiation.
::Return Slot Operator — Replaced the previous~|prefix-style return syntax with the::suffix-style return slot operator for a more consistent, readable design.- TAC IR Compiler — Replaced the stack-based multi-architecture compiler with a Three-Address Code (TAC) intermediate representation, reducing systemic code generation bugs.
- Full Class & Package Refactoring — Almost all classes renamed, updated, and repackaged for a cleaner and more navigable codebase structure.
- Removed ANTLR Dependency — Parser and lexer now fully hand-written to reduce external dependencies and improve implementation control.
- New Variable Declaration Syntax — Replaced
<type> <name>with<name>: <type>style declarations:name: type— typed declarationname: type = value— explicit declaration with assignmentname := value— type-inferred declaration with assignmentname = value— plain reassignment
- Three World System — Established three distinct program types for Coderive: Script (top-level imperative code), Method-only (function library), and Module (reusable component).
textType — Replaced the previousstringkeyword withtextas the built-in string type.- Natural Arrays — Introduced lazy range-based arrays:
- Range support (
[0 to N]) with lazy generation - Immutable by default; opt-in mutability available
textvalues supported as iterable natural arrays
- Range support (
- Numeric Shorthands — Added common suffixes for large numbers:
K(thousand),M(million),B(billion),T(trillion),Q(quadrillion),Qi(quintillion),e(scientific notation). Case-sensitive. - Parameter Skipping & Named Arguments — Added support for skipping positional parameters and passing arguments by name for improved call-site readability.
shareExport Keyword — Introducedshareas the visibility modifier for publicly accessible declarations, replacing the earliershipkeyword.
- Updated all demo files to reflect the new variable declaration syntax, quantifier syntax, and export keyword.
- Added
ParamSkipDemo.coddemonstrating named argument and parameter-skipping behaviour.
- Completely abandoned
&&and||operators - Embracing quantifier-first design
- Quantifier-First Logic System
- Replaced traditional boolean operators with expressive quantifiers
any[]andall[]syntax for clear, intentional logic- Natural language syntax that lowers learning curve
- Eliminates common operator precedence mistakes
// Clean, consistent bracket-based syntax
if any[isReady, hasBackup, forceMode]
if all[scores >= 60, !isFailed, attempts < 3]
user == any[admin, moderator, owner]- Updated conditional chain parsing to use
LBRACKET/RBRACKETconsistently - Enhanced error messages for mixed logical styles
- Improved support for array-based logical operations
- Updated
InteractiveDemo.codshowcasing clarity ofany[]/all[]syntax
- Conditional Chain Syntax
- Method call style:
user.hasPermission(any: "read", "write", "execute") - Equality style:
status == any:("active", "pending", "verified") - Inner negation support:
user.checkStatus(all: "active", !"banned") - Short-circuit evaluation for optimal performance
- Method call style:
- Added
BANGtoken for logical negation (!) - Extended comparison expression parsing for equality chains
- Support for nested conditional chains
- Parentheses handling (optional for methods, required for equality)
- Added
EqualityChainNodefor equality-style conditional chains - Enhanced
MethodCallNodewith chain type and arguments - Updated AST factory with chain creation methods
- Conditional chain evaluation in
ExpressionEvaluator - Truthiness detection for various value types
- Recursive chain expansion with proper short-circuiting
- Added
ALLandANYtoken types - Enhanced symbol recognition for new syntax
- Improved token type organization
- Separated Error Handling from the
ManualParser - Encapsulated token types into inner class in Manual Lexer
- Added
builtinkeyword - Introduced first version of
Sys
- PascalCase for class naming
- camelCase/snake_case for method/field/variable naming
- ALL_CAPS for final method/field/variable naming
finalas implicit based on naming patterns
- Fixed multiple parsing and evaluation bugs in the early-stage compiler and interpreter.
- Resolved token handling edge cases in the manual lexer.
- Improved multiple return value handling via the
::return slot operator. - Enhanced slot assignment mechanisms for more reliable multi-value returns.
- Fixed edge cases in slot resolution when methods return more than one named value.
- Created the first public repository for the Coderive programming language.
- Initial commit establishing the foundational codebase structure, including the manual lexer, basic parser, and early interpreter skeleton.
- Project inception marking the start of Coderive language development.