* 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
* Add -Z option to print string tree
* Simple test to print an AST
* Make CompiledScript owner of the tree
* some refactoring
- rename ecompile.cfg option
- rename AST generator class
* core-changes, docs
* fix warnings
* 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'
* Add Report.debug
* Implement function call scoping
* Implement variable scoping
- Rename `Identifier::scope` to `calling_scope`, and concatenate the identifier scope into `name` if necessary.
- Track current scope in SemanticAnalyzer, similar to UserFunctionVisitor.
- Use current scope in SemanticAnalyzer when visiting identifiers.
* Update grammar for `::identifier` global scoping
* Introduce ScopableName for function resolution
* Address review comments
- Check for display_debugs missing
* Add ScopableName for identifier resolution
* Some cleanup
- Remove `Identifier::calling_scope`, as it is tracked in the semantic
analyzer
- Refactor `ScopeName::exists` to `global` for better clarification of
its use
- Removed `X::maybe_scoped_string/name`
* Address self-review comments
* Rename `Function::module_name` to `scope`
* 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
* 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
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/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.
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");
* Add codegen/InstructionEmitter
* Add codegen/InstructionGenerator
* CodeGenerator: emit progend
Checkpoint: compiler can compile an empty file
* Comment reason for having both emit and emitter.