The DixScript Console Application now includes a comprehensive test file system with three levels of complexity: Basic, Intermediate, and Advanced. Each level tests different features of the DixScript language and processing pipeline.
DixScriptConsoleApp/
├── Program.cs # Main entry point with test selection
├── TestScenario.cs # Enum defining test scenarios
├── TestRunner.cs # Test execution and performance utilities
├── TestFiles/
│ ├── BasicTest.cs # Basic DixScript test cases
│ ├── IntermediateTest.cs # Intermediate test cases with enums
│ └── AdvancedTest.cs # Advanced tests with functions & events
└── DixScriptConsoleApp.csproj # Updated project file
- Features:
@CONFIG,@DLM, simple@DATAsections - Focus: Fundamental parsing, basic data structures, table/group syntax
- Test Cases:
SimpleConfig- Basic configuration and data structuresTableSyntax- Table/group syntax testing (27% more compact than TOML)DataTypes- Various data types, hex colors, prefixed constructorsErrorHandling- Parser resilience with intentional syntax errors
- Features: All basic features plus
@ENUMSand advanced@DATA - Focus: Enum usage, complex data structures, configuration management
- Test Cases:
EnumUsage- Enums with value assignments and usage in dataComplexData- Nested objects, arrays, complex inventory systemsConfiguration- Multi-environment configuration with database settings
- Features: All sections including
@QUICKFUNCSand@EVENTS - Focus: Function scoping, built-in registry system, event handling
- Test Cases:
CompleteFeature- Full language capabilities with functions and eventsFunctionScoping- Advanced function scoping and data manipulationBuiltinSystem- Registry-based built-in system testing
# Run default test (Basic scenario, first test case)
dotnet run
# Run specific scenario
dotnet run basic # All basic features
dotnet run intermediate # Include enums and complex data
dotnet run advanced # Full language features
# Run specific test case within scenario
dotnet run basic SimpleConfig
dotnet run intermediate EnumUsage
dotnet run advanced CompleteFeature
# Partial matching supported
dotnet run a builtin # Matches "BuiltinSystem" in advanced
dotnet run i complex # Matches "ComplexData" in intermediatedotnet run b # Basic
dotnet run i # Intermediate
dotnet run a # Advanced
dotnet run d # Default- ✅
@CONFIGsection processing with feature control - ✅
@DLMmodule selection (DCompressor, DAuditor, DEncryptor, DErrorHandler) - ✅ Simple
@DATAwith table/group syntax - ✅ Basic data types: int, float, double, string, bool, arrays
- ✅ Hex colors (#RGB, #RGBA, #RRGGBB, #RRGGBBAA)
- ✅ Prefixed constructors:
b:(),t:(),r:() - ✅ Date and timestamp handling
- ✅ Error recovery and synchronization
- ✅ All basic features
- ✅
@ENUMSsection with named constants - ✅ Enum value usage in data sections
- ✅ Complex nested data structures
- ✅ Multi-environment configurations
- ✅ Advanced data lifecycle modules
- ✅ All intermediate features
- ✅
@QUICKFUNCSsection with function scoping - ✅
@EVENTSsection with auto-firing compilation events - ✅ Registry-based built-in system:
- Static Object Registry:
Math.max(),DateTime.now(),Array.range() - Instance Method Registry:
.toUpper(),.length(),.format()
- Static Object Registry:
- ✅ Function scoping: global, group-specific, object-specific
- ✅ String interpolation:
$"text {expression}" - ✅ Method chaining:
value.method1().method2() - ✅ Full expression capabilities: arithmetic, comparison, logical operations
- ✅ CONFIG and ENUM access in events
- ✅ Dix system functions:
Dix.logEvent(),Dix.getSystemInfo()
@DATA(
// Simple properties
app_name = "GameSystem",
// Table properties (single line)
server.config: host = "localhost", port = 3000,
// Group arrays with double colon
world.levels::
{ name = "Forest", difficulty = 1 },
{ name = "Cave", difficulty = 2 }
)
@QUICKFUNCS(
// Global scope - callable anywhere in DATA
~calculateBonus<int> => global (base<int>) {
return Math.min(base * 1.5, 10000);
},
// Group scope - only callable within server.config group
~validateServer<bool> => server.config (host<string>, port<int>) {
return host.length() > 0 && port > 1000;
}
)
@DATA(
server.config:
host = "localhost",
port = 8080,
// Function using variables from same group
is_valid<bool> = validateServer(host, port)
)
@QUICKFUNCS(
~testBuiltins<string> => global (text<string>, numbers<array>) {
// Static object methods
current_time = DateTime.now();
max_number = Math.max(numbers);
// Instance methods with chaining
processed_text = text.trim().toUpper().substring(0, 10);
formatted_time = current_time.format("yyyy-MM-dd HH:mm:ss");
return $"Processed: {processed_text} at {formatted_time}";
}
)
@EVENTS(
on:parse {
// Access CONFIG values
version = config.version;
// Use built-ins and string interpolation
timestamp = DateTime.now().format("HH:mm:ss");
Dix.logEvent($"Parse started for v{version} at {timestamp}");
},
on:compile {
// Complex built-in usage
performance = Math.max(Random.range(50, 100), 75);
Dix.logEvent($"Compilation performance: {performance}%");
}
)
=== DixScript Console Application ===
Selected Test Scenario: Basic
Selected Test Case: SimpleConfig
=== Stage 1: Config Section Processing ===
✅ Config section processed successfully
=== Stage 2: Lexical Analysis ===
✅ Tokenization complete: 156 tokens generated
=== Stage 3: Parsing ===
✅ Parse Results: DixScript AST
=== Stage 4: Semantic Analysis ===
✅ Semantic Validity: VALID
Error Count: 0
=== Processing Summary ===
Test Scenario: Basic
DixScript Version: 1.0.0
Features Enabled: basic
Token Count: 156
Overall Quality: ✅ EXCELLENT (Moderate)
Processing Status: ✅ SUCCESS
=== DixScript Console Application ===
Selected Test Scenario: Advanced
Selected Test Case: CompleteFeature
=== Stage 1: Config Section Processing ===
✅ Config section processed successfully:
CONFIG(version -> "2.0.0", features -> "advanced")
=== Stage 2: Lexical Analysis ===
✅ Tokenization complete: 847 tokens generated
=== Stage 3: Parsing ===
✅ Parse Results: Complete AST with QuickFunctions and Events
=== Stage 4: Semantic Analysis ===
✅ Semantic Validity: VALID
✅ Function scoping validation passed
✅ Built-in registry validation passed
Error Count: 0
=== Processing Summary ===
Test Scenario: Advanced
Features Enabled: advanced
Token Count: 847
Overall Quality: ✅ EXCELLENT (Very Complex)
Processing Status: ✅ SUCCESS
The console application tracks various performance metrics:
- Token Generation Speed: Tokens generated per second
- Parse Time: Time to build AST from tokens
- Semantic Analysis: Validation time for complex features
- Memory Usage: Estimated memory consumption
- Throughput: Characters processed per second
- Basic Tests: 50-200 tokens, 5-15ms processing time
- Intermediate Tests: 200-500 tokens, 15-50ms processing time
- Advanced Tests: 500-1000+ tokens, 50-150ms processing time
The test system includes comprehensive error handling:
@DATA(
valid_prop = "correct",
bad_prop = "missing quote, // ❌ Intentional error
recovered_prop = "continues" // ✅ Parser recovers
)
- Missing
@CONFIG: Error reported, pipeline stops - Missing
@DATA: Warning issued, continues processing - Invalid DLM modules: Warning with fallback options
- Function scope violations
- Undefined enum references
- Type mismatches in expressions
- Invalid built-in method calls
The test system is designed to work seamlessly with the GitHub Actions workflow:
# In run-dixscript.yml
- name: Run comprehensive tests
run: |
echo "Testing Basic Features"
dotnet run basic
echo "Testing Intermediate Features"
dotnet run intermediate
echo "Testing Advanced Features"
dotnet run advanced- Detailed token output (first 20 tokens shown)
- Step-by-step pipeline execution
- Comprehensive error messages with line/column information
- Performance timing for each stage
- Add test case to appropriate
TestFiles/*.csfile - Update
GetAllTests()method to include new test - Test with:
dotnet run [scenario] [testname]
- Basic: Focus on core parsing and simple data structures
- Intermediate: Add complexity with enums and nested structures
- Advanced: Include functions, events, and built-in usage
- Include both positive and negative test cases
- Add comments explaining test objectives
"Test case not found"
- Check spelling of test case name
- Use partial matching:
dotnet run a builtininstead ofBuiltinSystem - Run without test case to see available options
"Config processing failed"
- Check for missing closing parentheses in
@CONFIG - Verify required fields:
version,features - Ensure proper
->syntax for key-value pairs
"Tokenization errors"
- Check for unmatched quotes, braces, or parentheses
- Verify section syntax:
@SECTION(content) - Look for invalid characters or escape sequences
"Semantic validation failed"
- Check function scoping rules
- Verify enum values exist before usage
- Ensure built-in method calls use correct syntax
- Performance Benchmarking: Automated performance regression testing
- Test Coverage: Code coverage analysis for parser components
- Memory Profiling: Detailed memory usage analysis
- Parallel Testing: Run multiple test scenarios simultaneously
- Custom Test Definition: JSON-based external test case definitions
- Integration Tests: Cross-section dependency validation