0.    Preliminary Notes

0.1.  What’s New in Unimal 2.1

0.1.1.     Motivation

0.1.2.     Macro definitions

0.1.3.     Macro expansions

0.1.4.     Repeat/While loop construct

0.1.5.     Save and Restore operators

0.1.6.     String expressions

0.1.7.     Syntactic sugar

0.1.8.     Command line switches

0.1.9.     Error reporting

0.1.10.Bug Fixed in release 2.1 build 231

0.2.  Document conventions

0.3.  Additional Resources

1.    Foreword: What is Unimal?

2.    Quick Start with Unimal

2.1.  Tabulating a function: Unimal loops and built-in math

2.2.  Parameters sharing among languages: Export statement

2.3.  Software distribution: If statement

2.4.  Further applications

2.5.  Highlights of other Unimal language features

2.5.1.     Composite names

2.5.2.     Macros

2.6.  Publishing the indices of array entries to a header file

2.6.1.     A useful design pattern

2.6.2.     Export Push/Pop and string expressions

2.6.3.     Include statement

2.7.  Toward truly reusable macros: inspecting properties of the arguments

3.    Invoking Unimal

3.1.   –i and –I options

3.2.  –o and –O options

3.3.  –d, –D options

3.4.  –p option

3.5.  -N option

3.6.  -S option

3.7.  -f option

3.8.  Default output

3.9.  Error reporting: Unimal.err

4.    Unimal language reference guide

4.1.  General

4.2.  Literals

4.2.1.     Numbers

4.2.2.     Strings

4.3.  Macro parameters (compile-time variables)

4.4.  Simple Names

4.5.  Formats

4.5.1.     %s

4.5.2.     %d, %u, %x, %X

4.5.3.     %n

4.6.  Composite names

4.7.  Target language interface

4.8.  Numeric Expressions

4.8.1.     Terms and operations

4.8.2.     Arithmetic expressions

4.8.3.     Shift expressions

4.8.4.     Bitwise logic expressions

4.8.5.     Logical expressions

4.8.5.1.Comparisons

4.8.5.2.Negation ‘!’

4.8.5.3.Logical AND ‘&&’ and OR ‘||’ expressions

4.9.  String Expressions

4.10.       Attributes

4.11.       Built-in Expressions

4.11.1.Logical built-ins

4.11.1.1.                    Defined

4.11.1.2.                    Isconst

4.11.2.Numeric functions

4.11.2.1.                    Math functions

4.11.2.2.                    Misc. functions

4.11.3.String expressions

4.11.3.1.                    Name-to-string conversion

4.11.3.2.                     Substring extraction uSubstr

4.11.3.3.                    Concatenation uJoin

4.11.3.4.                    Simplified Concatenation

4.11.3.5.                    Splitting a string uSplit

4.11.3.6.                    Defined encoding

4.12.       Unimal Operators

4.12.1.Empty operator

4.12.2.For

4.12.3.Endfor

4.12.4.Repeat

4.12.5.While

4.12.6.If

4.12.7.Else

4.12.8.Endif

4.12.9.Ifdef

4.12.10.                    Set

4.12.11.                    Setstr

4.12.12.                    Macro

4.12.13.                    Endm

4.12.14.                    Expand (non-recursive)

4.12.15.                    Expand (possibly recursive)

4.12.16.                    Include

4.12.17.                    Export

4.12.18.                    End

4.12.19.                    Undef

4.12.20.                    Save

4.12.21.                    Restore

4.13.       A useful shorthand for a list of arguments

4.14.       Special macro parameters

4.14.1.uAutoLine

4.14.2.uAutoLineOut

5.    Error Detection and Recovery

5.1.  Error logging mechanism in Unimal

5.2.  Unimal error messages reference

5.2.1.     Default format of an error message

5.2.2.     Error message format mimicry

5.2.3.     F type: Fatal file errors

5.2.3.1.Error 0102

5.2.3.2.Error 0103

5.2.3.3.Errors 0104, 0105 (output file), 0106 (input file)

5.2.3.4.Error 0111

5.2.4.     Special F type error (Usage syntax)

5.2.5.     A type: Out of memory

5.2.6.     S type: Syntax errors

5.2.6.1.Error 2000 (The file has an unbalanced beginning or end of a block)

5.2.6.2.Error 2001 (General syntax error)

Common syntax errors

Syntax errors in expressions

Special case: syntax errors in macro expansions

5.2.6.3.Error 2002 (Macro redefinition)

5.2.6.4.Error 2004 (Missing actual argument)

5.2.6.5.Errors 2005, 2006, 2007 (Unmatched block operators)

5.2.6.6.Error 2009 (Bad macro reference)

5.2.6.7.Error 2010 (Unexpected type)

5.2.6.8.Error 2011 (undefined parameter)

5.2.6.9.Error 2012 (formatting in composite names or target language interface)

5.2.6.10.                    Error 2013 (expected macro parameter)

5.2.6.11.                    Error 2014 (expected a numeric)

5.2.6.12.                    Error 2015 (undefined string expression)

5.2.6.13.                    Error 2016 (invalid string expression)

5.2.6.14.                    Error 2017 (wrong number of arguments to a function)

5.2.6.15.                    Error 2018 (literal number too large)

5.2.6.16.                    Error 2019 (string not terminated)

5.2.6.17.                    Error 2020 (Nested macro definition)

5.2.6.18.                    Error 2021 (Unmatched While)

5.2.6.19.                    Error 2022 (Recursive macro expansion)

5.2.7.     L type: Lexical errors

5.2.8.     M type: Math errors

5.2.8.1.Errors 3500, 3501, 3502 (Arithmetic overflows)

5.2.8.2.Error 3503 (Divide by zero)

5.2.8.3.Error 3504 (Non-positive divisor in remainder operation

5.2.8.4.Errors 3510, 3511, 3512, 3513 (math functions errors)

5.2.9.     Internal errors

6.    Additional facts

6.1.  (No) implementation limits

6.2.  Tokenization

6.3.  Including an output file