fromJson(json) reconstructs heap-allocated AST from JSON. createNode factory
handles all 33 concepts. deleteTree for cleanup. Test verifies save→load→save
produces byte-identical JSON for the full Calculator model.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
toJson(ASTNode*) recursively serializes the AST to JSON with id, concept,
properties, and children structure. Added childRoles() to ASTNode for
enumeration. FetchContent pulls nlohmann/json v3.11.3. Test serializes the
full Calculator model and verifies every node in the JSON output.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds the three annotation types from SemAnno. Test builds SimpleFunctionExample
with @deref(batched), exercises OptimizationLock on Module, LangSpecific on
Variable, and DerefStrategy's derefTime child link.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Ports all 33 SemAnno concepts from MPS into C++ headers grouped by category.
Test builds the exact Calculator model from Phase1Test.mps as a 27-node C++
object graph and verifies every property, child link, and parent chain.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds generic child link support to ASTNode (addChild/setChild for multi/single-
valued roles, getChildren/getChild/allChildren for traversal). Function and
Variable as first child concepts of Module. Test builds Module->Function tree,
walks parent/child pointers in both directions, verifies single-valued replace.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds the C++ editor stack foundation with ASTNode (id, conceptType, parent pointer, virtual dtor) and Module as the first concrete concept (name, targetLanguage). Header-only, compiles with C++20, test passes all assertions.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Changed variables link ID from 8982541288447632589 to 8982541288447632590
- Changed functions link ID from 8982541288447632588 to 8982541288447632589
These are the correct link IDs from the structure definition.
- Removed comparison operators that need XML escaping (<, >, etc.)
- Use text-based operators (plus, times) instead of symbols
- Two functions: add() and multiply() with parameters and bodies
- Demonstrates core Phase 1 concepts: Module, Function, Parameter, Assignment, Return, BinaryOperation
This version should load without XML parsing errors.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Added to Calculator module:
- Global variable: PI
- Function add(x, y): Parameters, binary operations, assignments, returns
- Function isPositive(num): If/else statements, boolean literals, conditions
- Function sumTo(n): While loops, assignments, complex control flow
Now demonstrates:
- Functions with parameters and return types
- Multiple statement types (Assignment, IfStatement, WhileLoop, Return)
- Multiple expression types (BinaryOperation, VariableReference, Literals)
- Type annotations (PrimitiveType)
Should generate meaningful text output for textgen validation.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>