Implements the grammar and type checker for the CGIR's in-memory representation.
Types
MsgContext = object top*: Option[NodeIndex] ## the index of the top-level tree node the error appears in where*: NodeIndex ## the node where the error occurred
- Contextual information about an error. Source Edit
Procs
proc checkSemantics(m: CgModule; handler: ErrorHandler) {. ...raises: [Exception, KeyError, ValueError], tags: [RootEffect].}
- Makes sure the syntactically well-formed m is semantically well-formed, reporting an error (via handler) everywhere it's not. Error diagnostics are formatted and dispatched to handler as they're discovered -- the handler never being invoked means that the module is semantically well-formed. Source Edit
proc checkStmt(c; m; pos; err): bool {....raises: [Exception, KeyError, ValueError], tags: [RootEffect].}
- Makes sure a statement/block is well-formed. Returns whether the statement acts as a terminator. Source Edit
proc checkSyntax(m: CgModule; handler: ErrorHandler) {. ...raises: [Exception, ValueError], tags: [RootEffect].}
- Makes sure m is syntactically well-formed, reporting an error (via handler) everywhere it is not. The handler never being invoked means that the module is syntactically well-formed. Source Edit