TypeC declares the available data types of variables in MiniC. There are
atomic types Cbool, Cnat and Cint, and composite types Carr and Cfun:
- Cbool are booleans, i.e., true and false, which are the machine
words 1...1 and 0...0, i.e., -1 and 0 (interpreted as Cint).
- Cnat are unsigned integers bounded by the machine width
- Cint are signed integers bounded by the machine width
- Ctup(tyA) is a tuple type consisting of the types in array tyA.
- Carr(dim,ty) is an array of dimension dim of type ty.
For the definition of functions, it is allowed to use arrays with
an unspecified dimension which makes their use more flexible.
- Cfun(tyA,rty) is a function type mapping arguments of types in array
tyA to a potential value of return type rty (None means void).
Note that MiniC is viewed, as C, as a macro language for assembler
programs, so that all atomic data types are mapped to machine words.
Cint uses 2-complement for interpreting machine words as integers, while
Cnat simply interprets them as binary numbers.