Skip to main content

Module parser

Module parser 

Source
Expand description

ICL Parser — tokenizer, AST types, and recursive descent parser

Converts ICL text into an Abstract Syntax Tree (AST). Matches the BNF grammar defined in CORE-SPECIFICATION.md Section 1.

§Pipeline

ICL text → Tokenizer → Token stream → Parser → ContractNode (AST)

§Guarantees

  • Deterministic: same input always produces identical AST
  • Pure: no side effects, no I/O, no randomness
  • Complete errors: line:column for every error

Modules§

ast
ICL AST Types — Abstract Syntax Tree node definitions
tokenizer
ICL Tokenizer — converts ICL text into token stream

Functions§

lower_contract
Convert a parsed AST into a runtime Contract struct. This is the bridge between the parser output and the executor input.
parse
Parse ICL text into an AST ContractNode
parse_contract
Parse ICL text into a semantic Contract (parse + lower)