* all except pol
* pol and includes under defines
* something weird has happened
* remove own folder from include searchpath
* fixed remaining, adapted include style for external headers
* missing include
* implementation
* tests
* maybe fix windows compilation?
* undo change of match_flag_type
* switch to boost regex
* move flags to BRegExp object
* fix tests due to cmake 4 update
* update grammar
* update prettifier
* move flag parsing to BRegExp ctor
* add AST nodes, update instr generation and execution
* copy tests but use regular expression literals
* fix grammar for handling division correctly
* modify return values a bit, update tests
- string.match: make groups hold structs of matched, offset
- string.match: add offset
- string.replace: use a groups array like string.match vs individual arguments
* bundle of changes
- standardize error messages
- add more tests for coverage
- move BRegExp creation to static method: previous implementation had
ctor throwing, which was no good inside executor since it didn't have
a try/catch
* more tests; add OT_REGEXP to basic.em
* move string regex stuff to bregexp and support regex/wregex via std::visit
* maybe fix compilation errors?
* add unicode escape sequence handling
* really maybe fix compilation error?
* fix compiler warnings
* refactor a bit to remove duplicate code
* address discord comments
- just return wstring, no need for vector<wchar_t> method
* Add string.split by string and regexp
* Use Max_Split instead of Limit
This makes it match basic::SplitWords
* add support for empty string delim in SplitWords
* remove duplicate code across string.split and mf_SplitWords
* Squashed commit of the following:
commit b3148e069f
Author: turleypol <turley@polserver.com>
Date: Sat Sep 27 17:02:22 2025 +0200
memorylocation of input string is not allowed to changed, switched back
to uniqueptr
commit 5a4d1c8fcb
Author: turleypol <turley@polserver.com>
Date: Sat Sep 27 10:18:01 2025 +0200
no need to use ptr for input
commit 90fa0edc66
Author: turleypol <turley@polserver.com>
Date: Sat Sep 27 09:56:29 2025 +0200
fixed typo
commit bed4ff3ac9
Author: turleypol <turley@polserver.com>
Date: Sat Sep 27 09:47:36 2025 +0200
make Callback for BContinuation move only
* use uninit when group isn't matched
* fix multiline flag handling; add test
* add docs and doc example tests
* some cleanup
* address review comments
- allow move assignment
* add core-changes
* use c++20
* increased used clang version
* compiler report and logfacility use now compile time formatting, which
means that the formatstring gets checked at compile time. (which found 2 errors)
adapted a few places since report only accepts formatting arguments
adapted a few places with logging since char[] is compile time
formatting and string or chr* is runtime formatting
* use std::ranges instead of boost
* disabled pragma_assume vs specific macro (I guess noone cares)
* needed to fix ancient ms exception code
* modernized SpinLock
* removed unused code in ECompile
* replaced std::filesystem::path::u8string with string. It now returns an actual u8string type
* cleanup layers.h added the defines for other layers which where before
only defined in the pkt
* osmod::OpenConnection and HTTPRequest cleanup: early outs, dont check for pChild which is
only needed for startscript and placed suspend at the very last
position
* fix warning
* rebuild cache with new compiler version
* define c++ standard for external libs where possible
* added fixme
* first working short curcuit for && and or
creates jumps after each expressions to skip the following
* fixed valuestack when short circuit jmp does not jump
* use specialized instructions for short circuit && and ||
1: lhs
2: logical jump if false/true goto 4 <- if jmp do logical convert
3: rhs
4: logical convert
5: rest
logical convert is needed since "normal" && || operations convert isTrue
to BLong
added BObjectRef BObjectImp set specialization to remove noise
* fixed converted objimp when jump on false values
* first version of short circuit warning
should be moved to analyzer
added whitelist of module functions which have no sideeffect to reduce
the number of warnings
* moved warning visitor to analyzer and added it as extra compile step
fixed sourceline print and cache the content
* missing include, unused member
* included the correct header
* ecompile.cfg to activate and warn
ecompile cmdline arg to activate it
run all tests also with it active
fixed that only the most right side statement was checked
* ecompile cmdline
* increase ecompile version
cleanup
* compilation error
* missing header
* allow -S- to deactivate shortcircuit like the other params do
* extended whitelist functions
* revert fileformat version increase
fixed escript test cmake
* use the correct arg
* escript testoutput can now be different if shortcircuit is active
* docs
* additional test
* addressed comments
* update grammar
* add ast nodes; ast building
* Rename to unpacking
* semantic analysis
* executor work part 1, unpacking indices
* renamings; implement index binding
* small cleanup
* use multi_index; more tests
* use multi_index only for rest, otherwise list
* initial formatting
* add missing token decoding
* address self-review comments
* formatting tweaks
* add test for var binding in classes
* add StringIterator
* fix spread tests
* add cfgfile iterator; add cfgelem opersubscript; tests
* add iterator for SQLResultSet and SQLRow; tests
* Copy value in take global/local
* Allow any iterable can index rest unpacking
Always use dictionary as rest object in index unpacking
* add docs, core-changes, doc tests
* formatting changes...
* address self-review comments
* update formatter, format all binding test srcs
* address review comments
- unset var scope
* add cfgfile/cfgelem docs
* reformat objref svg
* Update funcref table
- Add ctor funcref index
- Switch ctor list to be type tag offsets instead of funcref indexes
* Add pol tests for is, set-member across scripts
* Address GitHub CI annotations
- unused variable ‘uf’
* return longs instead of bools
* Support default args in funcref calls
- Simplify BFunctionRef by using funcref index
- Emit default args when visiting function reference
* Move default args gen to second-pass visit
* Better error message on param count errors
* Check for constructor in MTH_NEW
* Address self-review comments
- Update code comments
* Introduce ResourceManager to pol testsuite
- Create a new class-based resource manager for deleting resources
(item NPCs, multis) after each test.
- Migrate house_set_multiid test to use new ResourceManager.
* Move resource cleanup
* Update grammar
* Implement selfIs in BObjectImp
* Add tests
* Update grammar
* Support obj.function as a MemberAccess [1/2]
- AST generation changes
* Support obj.function as a MemberAccess [2/2]
- add funcref index to eprog class table ctor entry
- allow check_mro on non-class inst (skip ctor calls)
* Move address of funcref into funcref table
* Add funcref.new()
- Add class index to funcref table entry
- Add MTH_NEW
* Fix formatting
* Address self-review comments
* Some more tests
* Address self-review comments
* Update grammar
* Remove ObjMember read_only, hidden
No need to special-handle MBR_FUNCTION
* Addres GitHub CI annotations
- '=': conversion from 'size_t' to 'unsigned int', possible loss of data
* Associate class descriptor with class instance
* Skeleton of BClassInstance, update tests
* Correctly handle methods on class instances
* Support calling members as methods
* Update super-multiple test
* Track called ctors; Introduce ins_check_mro
* Move class method funcref class to Executor
* Address GitHub CI annotations
- 'argument': conversion from 'size_t' to 'unsigned int'
* Update pol-core/bscript/bclassinstance.cpp
* Introduce BConstObject for class instances
* Fix unnecessary include in uotool
* Removed fixedalloc from BConstObject
* Additional test case
* Address Discord comments
- Reintroduce deleted copy assignment
* Make ClassDeclaration only track class methods
* Keep methods, constructors in compiler workspace
- Fix UserFunctionBuilder to force reference to methods, constructors
- Fix Optimizer to include methods, constructors in referenced functions
* WIP for ClassDeclarationRegistrar
- Stub implementation of ClassDeclaration and its Registration
- Create "function table entry" via debug statements
* Use function links in methods
* Finish up ClassDescriptor
- Introduce MethodDescriptor for encapsulation
- ClassDeclarationRegistrar can register and take descriptors
* Handle read and write class table in eprog
* Pass Report to code generator for debug statements
* Fix implementation
- It _is_ possible for the constructor to be empty, ie. static classes
* Update DebugStoreSerializer
Print class table to dbg txt file
* Add missing method_names insertion
* Address GitHub CI Annotations
- unused variable 'uf'
- '=': conversion from 'size_t' to 'unsigned int'
* Grammar updates
- Make class parameters required
* Add ClassLink; wip with `super()` calls in ctors
* More AST nodes as ScopableNames
- (function call) Argument
- FunctionParameterDeclaration
* Add support for ambiguity handling
* Add few more tests
* Handle returns in constructors
- Semantic analysis to error on returning a value
- Introduce specific emitter method for returning from constructor
- Various tests
* Refactor super building to pre-semantic analysis
* Adding several tests, some are TODO
- found an issue with function resolver and funcrefs, fix later
* Address self-review comments
* Fix funcref global func references, tests
* Remove DefaultConstructorFunction
* Modify class parameters; update semantic analysis
- Use ClassDeclarationParameter for class decls vs Identifiers
- Update ScopableName to have equality for constructors and unscoped
function calls
- Update SemanticAnalyzer (self referencing base class, no ctor)
- Update, add tests
* Semantic updates; debug messaging updates
- Ensure base class is constructable
- Various fmt implementations for debugging
* Address self-review comments
* Update grammar
* WIP with tracking classes
- Refactor AvailableUserFunction to AvailableParseTree
- Track ClassDeclarationContexts similarly to user functions
* Skeleton AST + tracking
* Finish up AST building
* Implement AST building
- TODO decide better name for UserFunctionBuilder/Visitor,
since it does both user functions and classes
* Update Prettifier
* Crude, first-round semantic analysis + codegen
- Currently, no real difference from regular functions
* Move class var statements to top level statements
* Add semantic analysis for base class existence
* Introduce ClassInstance AST node for generating `this` parameter
* Skeleton create class instance instruction
* Default ctor; 'this' byref; Error if multiple same baseclass
* Update grammar for scoped funcrefs and scoped identifiers
* Update prettifier, builders for scoped funcref, identifiers
* Fix CI issues
- Styling
- Shadowing
* Add grammar tests for scope; Remove scope from switch label
* Final draft todos
- Rename `VarStatement::class_name` to `scope`
- Comment why identifiers dont have scopes in enum declarations
- Remove code comment
* Introduce FunctionReferenceRegistrar
- Track function references created by functors
- Remove ValueStack-held attributes for functors
- Add Function References section to escript program
- Use Function References section in ins_functor
- Update escript version
* Update listfile snapshots
- Remove ValueStack-held attributes created by functors
* Add function reference tracking to function references
- `emit.function_reference` uses funcref registrar + emits that index
- `ins_funcref` uses parameter count + is variadic from prog funcref table
- update listfile snapshots
* Add core-changes
* Update grammar
* Update parser and AST generator
* Update semantic analysis
* Executor implementation
- Move Executor stack modification logic to BFunctionRef
- Handle user function calls
- Handle expression function calls
* Tests
* Update existing listfile snapshots
- Adds variadic boolean to instruction stack
- Changes instruction counts and offsets
* Fix test issue
* Better implementation of calling user functions
* Add var-args-captures test
* Refactor continuation handling + handle variadic args
- Move stack modifications from make/withContinuation into the executor's handling of the continuation
- Only trim args in continuation call if function is not variadic
* Add var-args-continuation test (via array.filter)
* update escriptguide + formatting, docs
* Fix CI annotations
- '=': conversion from 'size_t' to 'unsigned int', possible loss of data
- declaration of 'continuation' hides previous local declaration
* initial poc of function expressions
- update grammar
- mock AST builder to return BBoolean(true) for a func expr
- update prettifier for skeleton implementation
* more skeleton work
create AST class FunctionExpression mimicking boolean value
* create ast UserFunction, add to workspace from functexpr
* can generate instructions
* reorg tests; add test for instructions
* can track FunctionDepth in Variable
* can get captures for funcexprs inside funcs.. tbd if this way of nesting works
* Implement create-functor instruction
- Move function depth from Variable to Variables
- Introduce stacking of `Variables` for function expresions via `FunctionVariableScope`
- Add `TOK_FUNCTOR` instruction for 'create-functor'
- Handle emitting a `FunctionExpression` AST node
- Update `emit.declare_variable` and `emit.access_variable` to account for function captures
- Remove `in_function` from instruction generator, as it is tracked via `UserFunction` stack
- Update tests
* Address Discord comments
- Swap pop param order
* Bubble up captured variables through nested functions
* Improve testing infrastructure; add some test cases
* Fix compilation error
* prepend captures to function parameters in funcref mth_call
* update tests
* move from function{} to @{}
* implementation fix
* some more tests
* update docs
* Some cleanup
* fix CI annotation warning
- 'argument': conversion from 'size_t' to 'VariableIndex', possible loss of data
* Address review comments
- Add `passert_always`
- Use better example in docs
* Some cleanup
- Remove unused functions
* added escriptgrammar as external lib where it belongs. Silenced warnings.
* bscript compiler warning fixes
* special include file to get rid of gcc warnings about antlr4
* misc windows warnings
* time specifc warnings
* buildfix + apple warnings
* never trust apple
* windows debug build warnings
* some windows clang warnings
* last warning fix
Also: OG compiler debug info for foreach iterator changed to match actual variable name
Adds:
- ast/DebugStatementMarker: for "intrusive debug" (ecompile -i) instructions
- codegen/DebugBlockGuard: pushes and pops debug block #
- format/DebugStoreSerializer: writes .dbg and .dbg.txt files
- representation/DebugBlock: holds parent block # and local variable names for each block
- representation/DebugStore: holds all debug information
Adds:
- ast/ElementAccess: AST node for x[a] or x[a,b,...] (may be get or set)
- ast/ElementAssignment: AST node for x[a] := b;
- ast/ElementIndexes: AST node to hold all indexes for element lookup
- optimizer/AssignmentOptimizer: optimizes := in different circumstances
Adds:
- ast/DictionaryEntry: AST node for a key -> value pair in a dictionary initializdr
- ast/DictionaryInitializer: AST node for creating a new dictionary
- ast/UninitializedValue: AST node for an uninit object
Adds:
- ast/CaseDispatchDefaultSelector: AST node for a "default:" selector
- ast/CaseDispatchGroup: AST node for a collection of selectors and the code to execute
- ast/CaseDispatchGroups: AST node holding all groups in a case statement
- ast/CaseDispatchSelectors: AST node holding all selectors for one group
- ast/CaseStatement: AST node for a whole case statement
- codegen/CaseDispatchGroupVisitor: knows what to put in a case jump dispatch table
- codegen/CaseJumpDataBlock: knows how to build the entries in the data block
Also, detect multiple case selectors with the same value (or default). This is different from the OG compiler, which only detected duplicate `default:` selectors.
Adds:
- ast/AssignVariableConsume: AST node for assignment to a variable, while consuming the result
- optimizer/ValueConsumerOptimizer: Optimizes expressions where the resulting value will be consumed
Adds:
- ast/UserFunction AST node for user-defined functions.
- astbuilder/AvailableUserFunction: reference to a parse tree for a user function.
- The AST builder only generates ASTs for user functions that are actually referenced.
- astbuilder/UserFunctionVisitor: visits (builds an AST for) a parse tree for a user function.
- This happens after the .src or .inc file has been otherwise processed, so this class serves to hook up the correct SourceFileIdentifier to the AST.
Add:
- ast/ExitStatement: AST node for the exit statement.
- ast/ReturnStatement: AST node for the return statement.
- only handles top-level returns and returns inside program declarations, which do the same thing: progend.
Adds:
- ast/Block: a block scope that allows declaring local variables
- ast/IfThenElseStatement: AST node for if..elseif..else..endif statements
- model/FlowControlLabel: provides an anchor for jumps or calls.
- Function calls, break statements, continue statements, and loops will all use these.
Adds:
- analyzer/LocalVariableScope: tracks local variables created within a given scope.
- Instantiated on the stack during semantic analysis, this registers itself with LocalVariableScopes during construction and deregisters itself during destruction.
- Detects unused variables during deregistration
- analyzer/LocalVariableScopes: this is what LocalVariableScope registers with.
- keeps track of the stack of local scopes.
- can provide the current local scope, for var statements.
Other notes:
"Shadowed" variables: this is when a variable in one scope hides a variable in another, like so:
var a := 2;
if (a)
var a := 3;
a := 4;
endif
print(a); // still 2
"debug_variables": We'll use these later when writing debug files.
Adds:
- UnaryOperator: AST node for unary operators -, ++, --, and so forth
- UnaryOperatorOptimizer: optimizes a unary operator with its operand
- now integer and float negation, and integer inversion
- later x[y]++ to a single instruction
Also:
- automatically include basic.em, which includes some parameter defaults like -1.
This allows the compiler to generate output for a hello, world script with the exact same .ecl output as the legacy compiler.
Adds support for var statements at the global level.
Adds:
- analyzer/Variables: keeps track of the variables in scope (either local or global).
- ast/Identifier: AST node for an identifier.
- The optimizer will replace constant identifiers with their constant value (in a later commit).
- The semantic analyzer will set the variable field for local or global variable identifiers.
- ast/VarStatement: AST node for a var statement.
- A single var statement will generate one VarStatement per variable declared.
- model/Variable: Describes a variable, including its index within its scope.
Adds:
- ast/Argument: AST node for an argument passed to a function.
- ast/FunctionCall: AST node for a function call.
- codegen/ModuleDeclarationRegistrar: The code generator registers module function declarations with this in order to determine module indexes and function indexes for instructions.
- model/FunctionLink: this is a reference either:
- from: a FunctionCall or a FunctionReference
- to: a ModuleFunctionDeclaration or a UserFunction
- optimizer/ReferencedFunctionGatherer: a visitor that determines which module functions and user functions are referenced, by looking at function calls and function references.
Also:
- CodeGenerator registers module functions
- InstructionGenerator generates code for function calls
- InstructionEmitter generates TOK_FUNC instructions
- StoredTokenDecoder decodes TOK_FUNC instructions
After all of this, the compiler can compile print("hello, world");