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>
- New sandbox: Phase1Example.sandbox with proper module descriptor
- Test model: Phase1Test.mps with minimal Phase 1 concept usage
- Registry includes Module and Variable with proper child relationships
- Child relationships mapped: variables (2Ks9RG) and functions (2Ks9RH)
- Simple structure: Module containing one Variable
Avoids complex nested structures to focus on verifying basic concept resolution.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Changed all property role="name" to role="TrG5h" (the registered index)
- Changed property role="operator" to role="TrG5h"
- Uses proper registry index instead of property name string
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Added registry section with all Phase 1 concepts and their EcuMT IDs
- Mapped concepts to short index names (e.g., Module=2Ks9RF)
- Updated all concept attributes to use registry indices
- Updated all role attributes to use registry roles
- Follows same pattern as existing SemAnno.sandbox.mps model
This allows MPS to properly resolve concept definitions from the model itself.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Changed language use from structure to actual SemAnno language
- Matches the language configuration in SemAnno.sandbox.msd
- Allows proper concept resolution through language namespace
- Should resolve the 'bad concept index key' error
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Moved SimpleExample.mps to languages/SemAnno.sandbox/models/
- Removed redundantly created sandbox directory
- Test model now in the correct, existing sandbox location
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Created sandbox/ directory for test models (proper MPS structure)
- Created .mps module descriptor with SemAnno.structure dependency
- Created SimpleExample.mps using concept names instead of node IDs
- Uses proper role names (variables, functions, parameters, etc.)
- Uses readable property names (name, operator) instead of internal IDs
The sandbox is now properly configured to use the SemAnno language concepts.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Removed namespace prefix from all concept attributes (k8se:XXXX -> XXXX)
- Removed namespace prefix from all role attributes
- Made SemAnno.structure import implicit=true
- Corrects MPS concept index resolution for model instantiation
This should resolve "Bad concept index key" error when loading the model.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Module: MathLibrary containing functions and variables
- Variables: PI and E with float type annotations
- Functions demonstrating various features:
- add: Basic function with parameters, binary operations, return statement
- isPositive: IfStatement with binary operations and boolean literals
- factorial: While loop with binary operations and control flow
- processArray: ForLoop with variable references and array processing
- createPoint: Function returning a tuple with list literals
- Statements: Block, Assignment, If, While, ForLoop, Return, ExpressionStatement
- Expressions: BinaryOperation, VariableReference, Literals (Integer, Float, Boolean, Null, List)
- Types: PrimitiveType, ListType, TupleType, MapType
- Comprehensive test coverage of core AST structure
This model is ready for textgen compilation and output testing.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Provides step-by-step instructions for:
- Rebuilding the language to see duplicate ID errors
- Using 'Correct ID' intention to auto-fix each concept
- Verifying the build succeeds with zero errors
- Committing the fixed structure file
Expected duration: 10-15 minutes for all ~30 concepts
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The editor definitions referenced concepts with duplicate IDs in structure.mps.
The structure file needs ID correction before editors can be properly created.
To fix:
1. In MPS, open the SemAnno language
2. Right-click on problematic concepts (showing duplicate ID errors)
3. Select 'Correct ID' intention to auto-generate unique IDs
4. Once structure is clean, recreate editor definitions
See notes below for details.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>