Add unit tests to exercise all productions of the grammar in src/stapl/jamexp.c
Reverse-engineering steps and inputs:
* Write table dumper program to produce output similar to 'bison --report'
** Create main program from code in [1]
** copy in tables jam_yyexca ... jam_yydef from jamexp.c
** add glue-defines
** add string arrays for better output
* Write a unit test program (jamexp_shrd.*, driver jamexp_nongen.c) using C-tap-harness [2]
** Instrument jamexp.c to report parser shift/reduce actions
** Deriving the full grammar from the table dumper program was too much tedious work, therefore
** use the Stapl specification [3] and token table to find the possible operators
** write tests for simple (typically one-operator) expressions.
This exercised most of the productions except the ones involving array variables.
Up to this point the unit test program was a 64-bit Linux executable.
** Now the build environment needed to be changed to generate a 32-bit executable because pointers are casted to/from int32_t
causing core-dumps with 64-bit executables.
Observation: after the conversion some tests involving integers near INT32_MIN, INT32_MAX produced different results.
Corresponding tests were fixed and by conditionally compiling with '#ifdef __code_model_32__'
** Analysing the output of the table dumper program yielded test inputs for array expressions, finally exercising all productions
of the grammar.
[1] https://stackoverflow.com/questions/
20496216/retrieve-the-grammar-rules-from-the-generated-parsing-tables
[2] git://git.eyrie.org/devel/c-tap-harness.git
[3] http://www.jtagtest.com/pdf/jesd71_stapl.pdf
Integration hints:
* must be compiled as a 32-bit executable ('gcc -m32' was used)
* CPP options:
** -DURJ_JAM_YYDEBUG # debug output from src/stapl/jamexp.c
** --include config.h
** -Iinclude # "urjtag/gettext.h"
** -Isrc/stapl
** -Itests/stapl
** -I. # "tests/tap/macros.h" in tests/tap/basic.c/basic.h
* Source files:
** tests/stapl/jamexp_nongen.c # defines main()
** src/stapl/jamarray.c
** src/stapl/jamcomp.c
** src/stapl/jamexec.c
** src/stapl/jamexp.c # old non-generated version
** src/stapl/jamheap.c
** src/stapl/jamjtag.c
** src/stapl/jamstack.c
** src/stapl/jamsym.c
** tests/stapl/jamexp_shrd.c
** tests/tap/basic.c
* Libraries:
** libm
Signed-off-by: Peter Pöschl <pp+ujt2208@nest-ai.de>