axon check command performs full front-end validation of AXON source code, including lexical analysis, parsing, and semantic type checking.
Synopsis
Description
Validates an.axon source file through the complete compilation front-end pipeline:
- Lexer — Tokenizes source code and validates syntax
- Parser — Builds an Abstract Syntax Tree (AST)
- Type Checker — Performs semantic validation and type inference
Arguments
Path to the
.axon source file to validateOptions
Disable ANSI color codes in output (useful for log files or non-TTY environments)
Exit Codes
| Code | Meaning |
|---|---|
0 | Clean — no errors detected |
1 | Errors detected (lexer, parser, or type errors) |
2 | File not found or I/O error |
Output Format
Success Output
- ✓ Green checkmark
- Filename in bold
- Token count
- Declaration count
- Error count (always 0 on success)
Error Output
- ✗ Red X mark
- Filename with location (line:column)
- Error message
Type Error Output
Examples
Basic Validation
CI/CD Integration
Non-Interactive Mode
Pre-Commit Hook
Error Categories
Lexer Errors
Lexical errors occur during tokenization:- Unterminated strings
- Invalid characters
- Malformed numbers
Parser Errors
Syntactic errors occur during AST construction:- Missing required keywords
- Incorrect block structure
- Unbalanced braces
Type Errors
Semantic errors occur during type checking:- Type incompatibility
- Undefined references
- Invalid type assignments
- Epistemic type violations (e.g., Opinion → FactualClaim)
Performance
Thecheck command is optimized for fast feedback:
- Small files (<100 lines): ~10-50ms
- Medium files (100-500 lines): ~50-200ms
- Large files (500+ lines): ~200-500ms
Related Commands
compile
Compile to IR after validation
run
Execute after validation
Troubleshooting
File Not Found
Permission Denied
Solution: Check file permissions withls -l and ensure read access.
