Open
Conversation
### Summary
This PR modernizes and restructures the project layout, refactors build and interface code, and adds a faster arena-based allocation system for parser AST nodes. Legacy scripts and outdated test files were removed.
### Key Changes
**Project & Build Updates**
* Renamed the project from **gs2test** → **gs2parser** and improved build hygiene by using `${CMAKE_BINARY_DIR}` for outputs.
* Reorganized source code into clear module subdirectories (`ast/`, `parser/`, `compiler/`, `memory/`, etc.).
* Added automatic export header generation for proper shared library support.
* Moved JS and C bindings into `bindings/js/` and `bindings/c/` with updated includes.
**CI & Script Cleanup**
* Updated `Jenkinsfile` and `package.json` to match new naming/output conventions.
* Removed obsolete legacy/test scripts.
**Parser & Memory Improvements**
* Introduced a high-performance **ArenaAllocator** for AST node allocation.
* Refactored `ParserContext` and parser code to allocate nodes through the arena, enabling fast bulk cleanup and better cache locality.
* Simplified allocation/lifetime handling and added cleaner debug stats.
**Codebase Refactoring**
* Consolidated compiler logic under `src/compiler/`.
* Updated visitor structure (`astvisitor.h` → `NodeVisitor.h`).
* Renamed and reorganized Rust bindings and codegen/compiler files for consistency.
* Removed fmtlib dependency from submodules
### Impact
The repo is now cleaner and more modular, supporting multi-target builds (native, shared/static, JS, C, Rust). Parser performance and memory behavior are significantly improved, and CI/build outputs are more reliable.
* arena allocator for ast node allocations & change directory structure * cmake changes * fix gs2test location * Attempt to fix windows build * ^ * ^ * ^ * package fix attempt * Fix rust build * Remove fmtlib dependency * cmake changes * fix osx? * ^ * ^ * ^ * ^ * Remove submodule winflexbison
…usage in parser, and refactored built-ins
- Bug 1 — All pre-jumps pointed to end of script: Every function's OP_SET_INDEX pre-jump was deferred and patched in getByteCode() to the final opIndex. If top-level code appeared between function groups, it was silently skipped. - Bug 2 — Duplicate function names left unpatched jumps: When addFunction rejected a duplicate name, the second declaration's jmpLoc was discarded, leaving its OP_SET_INDEX targeting address 0. Test: Added functions/04_prejump_grouping.gs2 covering interleaved top-level code between function groups. This should fix issue #1
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.
Memory Fixes
Parser Bug Fixes
Other Changes