Wiki

Compile Time Trace

Emit diagnostic information for the given expression showing the expression state at various stages of its compilation.

Mostly only of use for compiler development.

Currently this information is

  • expression state before binding to implementation.
  • expression state after bind imp
  • definition of the expression
  • Type of the expression

This can be used to see what intermediate definition and Type the compiler is generating for an expression.

Grammar

ct_trace <expression>

Example

 x = nil
 ct_trace x
        ...

generates output like

* Compile-time trace at Token(ID, 'ct_trace', 'ct_trace', ln 14, col 3, dec.cobra)
    * before bind imp on expression: x = IdentifierExpr-sh(6682, didBindInh=false, didBindInt=false, didBindImp=false, 
token=Token(ID, 'x', 'x', ln 14, col 12,dec.cobra), name=x, type=nil, 6682)
    * after bind imp on expression:  x = IdentifierExpr-sh(6682, didBindInh=false, didBindInt=false, didStartBindImp=true, didBindImp=true, token=Token(ID, 'x', 'x', ln 14, col 12, dec.cobra), name=x, type=NilableType-mi(15870, didStartBindInh=true, didBindInh=true, didStartBindInt=true, didBindInt=true, didBindImp=false, 15870), 
definition=LocalVar-mi(15871, name=x, didStartBindInh=true, didBindInh=true, didStartBindInt=true, didBindInt=true, didStartBindImp=true, didBindImp=true, token=Token(ID, 'x', 'x', ln 13, col 3, dec.cobra), isTracked=true, isTracked=true, 15871), 6682)
    * definition = LocalVar(15871, "x" (ID), x, dynamic?)
    * type = NilableType-sh(15870, didStartBindInh=true, didBindInh=true, didStartBindInt=true, didBindInt=true, didBindImp=false, wrappedType=DynamicType-mi(9750, didStartBindInh=true, didBindInh=true, didStartBindInt=true, didBindInt=true, 
didBindImp=false, 9750), 15870)