ADHOC uses 8 datatypes to classify values. The types are:
- Boolean – a simple true/false value.
- Integer – a numerical value without a decimal. Depending on the target language, may have an upper and lower bound.
- Float – a numerical value with a decimal. Depending on the target language, may have an upper and lower bound, and a degree of precision.
- String – a text value. Any text is valid, except quotation marks which must be escaped with a back-slash (
\"). Use of other escapes (e.g. \n \t \b, etc.) is supported and encouraged.
- Array – a numerically-indexed collection of other values. Some target languages will require that all values in the collection be of the same type, however, ADHOC generally does not require this. The size of an array need not be known when target code is generated, and the size can change dynamically during program execution.
- Hash – a string-indexed collection of other values. Othe than the indexing, hashes behave identically to arrays.
- Struct – a structured hash, with all indices pre-determined by a struct definition node.
- Action – a value representing a defined action. This allows for functional programming paradigms.
Similarly to many scripting languages, ADHOC itself does not delineate between primitive and complex datatypes, and it allows for late (“weak”) type checking. However, when generating code, ADHOC will hold to the standards of the target language, and may throw an error if certain actions are not compatible with the target type system.