From 4ddda94a4c61b7fa0b30eb7be89b49c0fae115e0 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Wed, 13 Feb 2013 09:27:33 -0500 Subject: [PATCH 01/94] TAME core library extracted from Calc DSL repository Some notes on this: The "Calc DSL" is the name of the DSL before it became "TAME". This takes the entire core library and squashes its 91 commits into a single one; the reason for this is because those commits often contain LoVullo-specific details that are either irrelevant or should not be included. This library has limited value to the public at the time of this commit, since TAME has not yet been released (it requires some additional cleanup and filtering before then). It is also in need of heavy refactoring and reorganization, since it has accumulated a lot of cruft, especially since the project in which the Calc DSL was introduced was rushed (to put it lightly). Forgive the mess. [LoVullo employees: the commit was extracted from dsl.git 4a3aea9; full history can be found there. This commit contains some additional minor tweaks in addition to squashing. It filters on the :/core/ directory.] --- core/base.xml | 123 +++++ core/cond.xml | 156 ++++++ core/datetime.xml | 88 ++++ core/map.xml | 113 +++++ core/numeric.xml | 21 + core/numeric/boolean.xml | 27 ++ core/numeric/common.xml | 118 +++++ core/numeric/convert.xml | 385 +++++++++++++++ core/numeric/minmax.xml | 331 +++++++++++++ core/numeric/round.xml | 252 ++++++++++ core/tdat.xml | 31 ++ core/test/spec.xml | 285 +++++++++++ core/vector.xml | 24 + core/vector/arithmetic.xml | 232 +++++++++ core/vector/cmatch.xml | 159 ++++++ core/vector/common.xml | 162 +++++++ core/vector/convert.xml | 16 + core/vector/count.xml | 47 ++ core/vector/interpolate.xml | 389 +++++++++++++++ core/vector/list.xml | 193 ++++++++ core/vector/matrix.xml | 95 ++++ core/vector/table.xml | 936 ++++++++++++++++++++++++++++++++++++ 22 files changed, 4183 insertions(+) create mode 100644 core/base.xml create mode 100644 core/cond.xml create mode 100644 core/datetime.xml create mode 100644 core/map.xml create mode 100644 core/numeric.xml create mode 100644 core/numeric/boolean.xml create mode 100644 core/numeric/common.xml create mode 100644 core/numeric/convert.xml create mode 100644 core/numeric/minmax.xml create mode 100644 core/numeric/round.xml create mode 100644 core/tdat.xml create mode 100644 core/test/spec.xml create mode 100644 core/vector.xml create mode 100644 core/vector/arithmetic.xml create mode 100644 core/vector/cmatch.xml create mode 100644 core/vector/common.xml create mode 100644 core/vector/convert.xml create mode 100644 core/vector/count.xml create mode 100644 core/vector/interpolate.xml create mode 100644 core/vector/list.xml create mode 100644 core/vector/matrix.xml create mode 100644 core/vector/table.xml diff --git a/core/base.xml b/core/base.xml new file mode 100644 index 00000000..dcbc034a --- /dev/null +++ b/core/base.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TODO + + + + + + + + + + + + + + + + + + + + + + + + + + -err-empty- + + + + + + is empty + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + diff --git a/core/cond.xml b/core/cond.xml new file mode 100644 index 00000000..ca6a588a --- /dev/null +++ b/core/cond.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TRUE + + + + Value when + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Constant value + + + + + + + + + + + + + + + + + + + + diff --git a/core/datetime.xml b/core/datetime.xml new file mode 100644 index 00000000..abeb49b8 --- /dev/null +++ b/core/datetime.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + _ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/map.xml b/core/map.xml new file mode 100644 index 00000000..b7366272 --- /dev/null +++ b/core/map.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + float + + + + Destination mapping + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/numeric.xml b/core/numeric.xml new file mode 100644 index 00000000..7dfc1d95 --- /dev/null +++ b/core/numeric.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + diff --git a/core/numeric/boolean.xml b/core/numeric/boolean.xml new file mode 100644 index 00000000..b61dd75f --- /dev/null +++ b/core/numeric/boolean.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + diff --git a/core/numeric/common.xml b/core/numeric/common.xml new file mode 100644 index 00000000..d31849fc --- /dev/null +++ b/core/numeric/common.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + 1 + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Percent to reduce + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/numeric/convert.xml b/core/numeric/convert.xml new file mode 100644 index 00000000..7c548893 --- /dev/null +++ b/core/numeric/convert.xml @@ -0,0 +1,385 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/numeric/minmax.xml b/core/numeric/minmax.xml new file mode 100644 index 00000000..fa1e420d --- /dev/null +++ b/core/numeric/minmax.xml @@ -0,0 +1,331 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Maximum value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/numeric/round.xml b/core/numeric/round.xml new file mode 100644 index 00000000..d41f76aa --- /dev/null +++ b/core/numeric/round.xml @@ -0,0 +1,252 @@ + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #0 + + + + #1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/tdat.xml b/core/tdat.xml new file mode 100644 index 00000000..0aa07e32 --- /dev/null +++ b/core/tdat.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + _ + + + + + + + + + diff --git a/core/test/spec.xml b/core/test/spec.xml new file mode 100644 index 00000000..14c9385f --- /dev/null +++ b/core/test/spec.xml @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/vector.xml b/core/vector.xml new file mode 100644 index 00000000..0ef98c5c --- /dev/null +++ b/core/vector.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + diff --git a/core/vector/arithmetic.xml b/core/vector/arithmetic.xml new file mode 100644 index 00000000..bab4a606 --- /dev/null +++ b/core/vector/arithmetic.xml @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + __ + + + + + Sum of vectors + + and + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/vector/cmatch.xml b/core/vector/cmatch.xml new file mode 100644 index 00000000..589ec1ea --- /dev/null +++ b/core/vector/cmatch.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + __ + + + + + Vector containing boolean + + classification matches + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/vector/common.xml b/core/vector/common.xml new file mode 100644 index 00000000..dbadb810 --- /dev/null +++ b/core/vector/common.xml @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/vector/convert.xml b/core/vector/convert.xml new file mode 100644 index 00000000..e5844258 --- /dev/null +++ b/core/vector/convert.xml @@ -0,0 +1,16 @@ + + + + + + + diff --git a/core/vector/count.xml b/core/vector/count.xml new file mode 100644 index 00000000..fdd333c0 --- /dev/null +++ b/core/vector/count.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/vector/interpolate.xml b/core/vector/interpolate.xml new file mode 100644 index 00000000..c281e028 --- /dev/null +++ b/core/vector/interpolate.xml @@ -0,0 +1,389 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/vector/list.xml b/core/vector/list.xml new file mode 100644 index 00000000..2d3d2f80 --- /dev/null +++ b/core/vector/list.xml @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + __car + + + __cdr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + __cdr + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/vector/matrix.xml b/core/vector/matrix.xml new file mode 100644 index 00000000..1640a923 --- /dev/null +++ b/core/vector/matrix.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + __ + + + + + rate_ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/vector/table.xml b/core/vector/table.xml new file mode 100644 index 00000000..c485e757 --- /dev/null +++ b/core/vector/table.xml @@ -0,0 +1,936 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RATE_TABLE_ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _RATE_TABLE_ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _RATE_TABLE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _ + + + + + + _ + + _IS_SEQ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From fb1416837b64ada04a7e07ca4c9c041a1aeeface Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Wed, 18 Mar 2015 11:31:47 -0400 Subject: [PATCH 02/94] Package namespace/imports/decl cleanup --- core/base.xml | 140 ++++++------- core/cond.xml | 123 ++++++----- core/datetime.xml | 57 +++--- core/map.xml | 109 +++++----- core/numeric.xml | 24 +-- core/numeric/boolean.xml | 20 +- core/numeric/common.xml | 85 ++++---- core/numeric/convert.xml | 8 +- core/numeric/minmax.xml | 199 +++++++++--------- core/numeric/round.xml | 104 +++++----- core/tdat.xml | 37 ++-- core/test/spec.xml | 4 +- core/vector.xml | 29 ++- core/vector/arithmetic.xml | 137 ++++++------- core/vector/cmatch.xml | 167 ++++++++------- core/vector/common.xml | 73 ++++--- core/vector/convert.xml | 16 +- core/vector/count.xml | 27 +-- core/vector/interpolate.xml | 107 +++++----- core/vector/list.xml | 93 ++++----- core/vector/matrix.xml | 55 +++-- core/vector/table.xml | 393 ++++++++++++++++++------------------ 22 files changed, 948 insertions(+), 1059 deletions(-) diff --git a/core/base.xml b/core/base.xml index dcbc034a..a6c362ee 100644 --- a/core/base.xml +++ b/core/base.xml @@ -1,123 +1,117 @@ - - + - - - + + + - + - + - + - - - + + + - - - + + + - - - - - - + + + + + + - - - + + + - + - - - TODO - + - - - + - - - - - + + diff --git a/core/cond.xml b/core/cond.xml index ca6a588a..c6933d63 100644 --- a/core/cond.xml +++ b/core/cond.xml @@ -1,22 +1,16 @@ - - + - + - - - + + + @@ -35,23 +29,23 @@ - + - - - - - + - - - - + - - - - + - - - - - - + + + diff --git a/core/datetime.xml b/core/datetime.xml index abeb49b8..045e742c 100644 --- a/core/datetime.xml +++ b/core/datetime.xml @@ -1,16 +1,10 @@ - - + - + - - - - - - + + + diff --git a/core/map.xml b/core/map.xml index b7366272..3e96971d 100644 --- a/core/map.xml +++ b/core/map.xml @@ -1,113 +1,108 @@ - + - - - - - - + - - - - + - - - + + + diff --git a/core/numeric.xml b/core/numeric.xml index 7dfc1d95..ea2273b2 100644 --- a/core/numeric.xml +++ b/core/numeric.xml @@ -1,21 +1,15 @@ - - + - - - - - + + + + + + + - - diff --git a/core/numeric/boolean.xml b/core/numeric/boolean.xml index b61dd75f..7ebaf0e5 100644 --- a/core/numeric/boolean.xml +++ b/core/numeric/boolean.xml @@ -1,20 +1,14 @@ - - + - + - - + + @@ -23,5 +17,5 @@ - - + + diff --git a/core/numeric/common.xml b/core/numeric/common.xml index d31849fc..5b40cf57 100644 --- a/core/numeric/common.xml +++ b/core/numeric/common.xml @@ -1,83 +1,77 @@ - - + - + - - + - - + - - - + - - - - + @@ -85,11 +79,11 @@ Calculates a value based on the given multiplier if the given value falls within the given range --> - - - - - + + + + + @@ -114,5 +108,6 @@ - - + + + diff --git a/core/numeric/convert.xml b/core/numeric/convert.xml index 7c548893..1519b2fd 100644 --- a/core/numeric/convert.xml +++ b/core/numeric/convert.xml @@ -1,13 +1,8 @@ - + @@ -383,3 +378,4 @@ + diff --git a/core/numeric/minmax.xml b/core/numeric/minmax.xml index fa1e420d..f55f3103 100644 --- a/core/numeric/minmax.xml +++ b/core/numeric/minmax.xml @@ -1,22 +1,16 @@ - - + - + - - - + + + @@ -33,12 +27,12 @@ - + - - - + + + @@ -55,15 +49,15 @@ - + - - - + - - - - - + - - - + + - - - + + + - - - Maximum value - + + Maximum value + - + - - + + - + - + - + - - - - - + - - - - + @@ -181,29 +175,29 @@ TODO: max is incomplete (should have all the options of min) --> - + + + diff --git a/core/numeric/round.xml b/core/numeric/round.xml index d41f76aa..d55c4528 100644 --- a/core/numeric/round.xml +++ b/core/numeric/round.xml @@ -1,30 +1,24 @@ - - + - + - - - - 0 - + - - - - - - + + - - - - - #0 - + #0 + - - #1 - + #1 + @@ -123,7 +117,7 @@ - + @@ -134,9 +128,9 @@ - + - + @@ -147,9 +141,9 @@ - + - + @@ -160,21 +154,21 @@ - + - + - + - - + + @@ -208,12 +202,12 @@ - + - - + + @@ -224,17 +218,17 @@ - + - - - + + - diff --git a/core/tdat.xml b/core/tdat.xml index 0aa07e32..ed3d33b5 100644 --- a/core/tdat.xml +++ b/core/tdat.xml @@ -1,31 +1,26 @@ - - + - + - - - - + + + diff --git a/core/test/spec.xml b/core/test/spec.xml index 14c9385f..993fd094 100644 --- a/core/test/spec.xml +++ b/core/test/spec.xml @@ -1,4 +1,4 @@ - + - - - - - - - + + + + + + + + + + - - diff --git a/core/vector/arithmetic.xml b/core/vector/arithmetic.xml index bab4a606..b2c5152d 100644 --- a/core/vector/arithmetic.xml +++ b/core/vector/arithmetic.xml @@ -1,87 +1,81 @@ - - + - - - + + + - - - - + - - - - + - - + + @@ -123,7 +117,7 @@ - + - - - + + + @@ -194,39 +188,40 @@ - + - - - - - + - - - + + + diff --git a/core/vector/cmatch.xml b/core/vector/cmatch.xml index 589ec1ea..abd123d5 100644 --- a/core/vector/cmatch.xml +++ b/core/vector/cmatch.xml @@ -1,17 +1,11 @@ - - + - - + + - - - - - - + - - - - + - - - + - - - - - - - - - + + + + + + + + + - - + + - - + - - - + + + - - - + + + + + + + - - - diff --git a/core/vector/common.xml b/core/vector/common.xml index dbadb810..82ef4996 100644 --- a/core/vector/common.xml +++ b/core/vector/common.xml @@ -1,38 +1,32 @@ - - + - - + + - - - + + + - + - - - - + + + + @@ -42,13 +36,13 @@ - + - - - - + @@ -70,13 +64,13 @@ will be used to map a value to an index within the matrix for either a row or column. --> - - - - + + + + - - + + @@ -97,13 +91,13 @@ - + - - - - + + + + @@ -151,12 +145,13 @@ - + - + - - + + + diff --git a/core/vector/convert.xml b/core/vector/convert.xml index e5844258..7e26be7a 100644 --- a/core/vector/convert.xml +++ b/core/vector/convert.xml @@ -1,16 +1,8 @@ - - + - - - - + + diff --git a/core/vector/count.xml b/core/vector/count.xml index fdd333c0..59debaad 100644 --- a/core/vector/count.xml +++ b/core/vector/count.xml @@ -1,31 +1,25 @@ - - + - + - - + + - + - - + + @@ -43,5 +37,6 @@ - - + + + diff --git a/core/vector/interpolate.xml b/core/vector/interpolate.xml index c281e028..0238a342 100644 --- a/core/vector/interpolate.xml +++ b/core/vector/interpolate.xml @@ -1,32 +1,26 @@ - - + - - + + - - - - - + - - - - - - + + + + + - - - - + + + - - - - - + + @@ -163,16 +157,16 @@ - + - + - + - + @@ -195,13 +189,13 @@ - + - + @@ -226,10 +220,10 @@ - + - + - - - - + + + + @@ -277,7 +271,7 @@ - + - - - - - + + + + + @@ -311,7 +305,7 @@ - + - - - + + + @@ -385,5 +379,6 @@ - - + + + diff --git a/core/vector/list.xml b/core/vector/list.xml index 2d3d2f80..d51f4017 100644 --- a/core/vector/list.xml +++ b/core/vector/list.xml @@ -1,17 +1,11 @@ - - + - + @@ -21,23 +15,23 @@ This template recurses and, as such, should only be used within functions. --> - - + @@ -157,31 +151,31 @@ This template recurses and, as such, should only be used within functions. --> - - + - - - + + + - - - - + - - - + + + @@ -91,5 +85,6 @@ - - + + + diff --git a/core/vector/table.xml b/core/vector/table.xml index c485e757..4322cbd5 100644 --- a/core/vector/table.xml +++ b/core/vector/table.xml @@ -1,28 +1,22 @@ - - + - - - + + + - - + + - - + + - - - + + - - - + + + - - - + + - - - - - - + + + + + + - - - + + - - - + + + - - - + + + - - - + + - - RATE_TABLE_ - - + RATE_TABLE_ + + - - - + - - - + + - - + + - - + - - - - + + - - - + + - - + + - - - - + + + - - + - - - - + + + + - - + - - + + - - - + - - - + - - - + - - - - + @@ -389,11 +383,11 @@ - - - + + + - + @@ -469,7 +463,7 @@ - + - - - - - - + + + + + + @@ -607,13 +601,13 @@ - + - - - - + + + + @@ -687,35 +681,35 @@ - + - - - - - + - - - - - + + + + + + + + + + + + + + + . + This framework uses specifications, not stories[0]. Its syntax is heavily motivated by popular BDD frameworks such as RSpec (Ruby), Jasmine (JavaScript), and Mocha (JavaScript). diff --git a/core/vector.xml b/core/vector.xml index b595e0d1..20c779e5 100644 --- a/core/vector.xml +++ b/core/vector.xml @@ -1,4 +1,22 @@ + + + + + + + + + + Date: Wed, 18 Mar 2015 13:50:06 -0400 Subject: [PATCH 05/94] README with description of TAME and Core features --- core/README.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 core/README.md diff --git a/core/README.md b/core/README.md new file mode 100644 index 00000000..1842ff26 --- /dev/null +++ b/core/README.md @@ -0,0 +1,64 @@ +# TAME Core +Core library for TAME, providing generic abstractions for common +operations. + +This library has accumulated a bit of cruft, is disorganized, and has +not been substantially refactored to take advantage of new language +features. It is a work in progress. + +This is also of limited use to others outside of LoVullo, since TAME +has not yet been liberated. + + +## Features +- BDD abstraction; +- Classification match manipulation; +- Common operations on numbers; +- Conditional evaluation helpers; +- Core primitive declarations; +- Interpolation; +- Interval mapping; +- Matrix and vector manipulation; +- Query matrices as data tables; +- Value mappings; and +- Other miscellaneous stuff. + + +## What is TAME? +TAME is The Adaptive MetalanguagE, a programming language and system of tools +designed to aid in the development, understanding, and maintenance of systems +performing numerous calculations on a complex graph of dependencies, +conditions, and a large number of inputs. + +This system was developed at LoVullo Associates to handle the complexity of +comparative insurance rating systems. It is a domain-specific language (DSL) +that itself encourages, through the use of templates, the creation of sub-DSLs. +TAME itself is at heart a calculator—processing only numerical input and +output—driven by quantifiers as predicates. Calculations and quantifiers are +written declaratively without concern for order of execution. + +The system has powerful dependency resolution and data flow capabilities. + +TAME consists of a macro processor (implementing a metalanguage), numerous +compilers for various targets (JavaScript, HTML documentation and debugging +environment, LaTeX, and others), linkers, and supporting tools. The input +grammar is XML, and the majority of the project (including the macro processor, +compilers, and linkers) are written in XSLT. There is a reason for that odd +choice; until an explanation is provided, know that someone is perverted enough +to implement a full compiler in XSLT. + +More information will become available as various portions are liberated during +refactoring; [hoxsl](https://github.com/lovullo/hoxsl) is a product of what is +now known as TAME. + + +## License +tame-core is free software: you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. From 02a4e256ac171881f326470c88a4822fb0d28488 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 19 Mar 2015 16:24:22 -0400 Subject: [PATCH 06/94] Handful of test cases This uses the BDD specification package `test/spec`. [LoVullo employees: this was extracted from the same point as the first commit, and includes some minor cleanup and moving around.] --- core/test/core/numeric/convert.xml | 209 +++++++++++++++ core/test/core/numeric/round.xml | 357 ++++++++++++++++++++++++++ core/test/core/suite.xml | 31 +++ core/test/core/vector/interpolate.xml | 336 ++++++++++++++++++++++++ core/test/spec.xml | 3 +- 5 files changed, 935 insertions(+), 1 deletion(-) create mode 100644 core/test/core/numeric/convert.xml create mode 100644 core/test/core/numeric/round.xml create mode 100644 core/test/core/suite.xml create mode 100644 core/test/core/vector/interpolate.xml diff --git a/core/test/core/numeric/convert.xml b/core/test/core/numeric/convert.xml new file mode 100644 index 00000000..0957939b --- /dev/null +++ b/core/test/core/numeric/convert.xml @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/test/core/numeric/round.xml b/core/test/core/numeric/round.xml new file mode 100644 index 00000000..feb9b773 --- /dev/null +++ b/core/test/core/numeric/round.xml @@ -0,0 +1,357 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/test/core/suite.xml b/core/test/core/suite.xml new file mode 100644 index 00000000..b489ceb8 --- /dev/null +++ b/core/test/core/suite.xml @@ -0,0 +1,31 @@ + + + + + + + + + + diff --git a/core/test/core/vector/interpolate.xml b/core/test/core/vector/interpolate.xml new file mode 100644 index 00000000..f5f4d67a --- /dev/null +++ b/core/test/core/vector/interpolate.xml @@ -0,0 +1,336 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/core/test/spec.xml b/core/test/spec.xml index 566d0259..c31c8382 100644 --- a/core/test/spec.xml +++ b/core/test/spec.xml @@ -1,4 +1,4 @@ - + @@ -158,7 +185,7 @@ - + From d2d595a3d771777f6ffdadb95d4c21e48d32ebc2 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Mon, 2 Nov 2015 15:48:09 -0500 Subject: [PATCH 24/94] Add _rtop_ template --- core/numeric/convert.xml | 1 - core/numeric/percent.xml | 94 +++++++++++++++++++ core/test/core/numeric/percent.xml | 142 +++++++++++++++++++++++++++++ core/test/core/suite.xml | 1 + 4 files changed, 237 insertions(+), 1 deletion(-) create mode 100644 core/numeric/percent.xml create mode 100644 core/test/core/numeric/percent.xml diff --git a/core/numeric/convert.xml b/core/numeric/convert.xml index 27174fa0..c5a056a2 100644 --- a/core/numeric/convert.xml +++ b/core/numeric/convert.xml @@ -413,4 +413,3 @@
- diff --git a/core/numeric/percent.xml b/core/numeric/percent.xml new file mode 100644 index 00000000..499c747c --- /dev/null +++ b/core/numeric/percent.xml @@ -0,0 +1,94 @@ + + + + + + + + Converting between real and~percent is trivial: + + $$ + \begin{align} + r &= p\over100; + p &= 100r. + \end{align} + $$ + + ^[Percent difference] (also called ^[relative change]) describes + the~change in value as a~percentage (for example: $10$~is $50%$ + of~$20$, and is~$100%$ of~$5$). ^[Percent change] recognizes the + direction of the change (that is---$10$ is~$20$ reduced by~$50%$, so + $p=-50$). + + Since ``change'' sounds like a~verb eclarative contexts, we use + the~term ^[percent difference] to mean ^[relative change]; it is + defined as: + + $$\delta \over x = {{x_\beta - x_\alpha}\over{x_\alpha}} \times 100 = p.$$ + + Notice that this preserves the direction of the change. So, in the + context of the previous example, we can say that $10$ + \emph{reduces}~$20$ by~$50%$, giving~$p=-50%$. + + + + diff --git a/core/test/core/numeric/percent.xml b/core/test/core/numeric/percent.xml new file mode 100644 index 00000000..36169fc1 --- /dev/null +++ b/core/test/core/numeric/percent.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + These tests are similar to the above, except that they represent + the~percent difference between two values. That is, given the + values $5$~and $15$, we arrive at a~$200%$ increase. So + if~$p=200$, then we want $5r=15, r=3=\((15-5)/5\)+1$. + + + + + + + + + + + + + + + + + Similarly, if we go from~$10$ to~$5$, we have~$p=-100$ + and~$10r=5$; then~$r=1/2=0.5$. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/test/core/suite.xml b/core/test/core/suite.xml index cab01254..64e14f76 100644 --- a/core/test/core/suite.xml +++ b/core/test/core/suite.xml @@ -28,6 +28,7 @@ + From 3a9ef76beae68528c9e2e380d9d8a69b7ac490ab Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Mon, 2 Nov 2015 15:50:54 -0500 Subject: [PATCH 25/94] Extract percent templates from convert.xml --- core/numeric/convert.xml | 243 +------------------------------------- core/numeric/percent.xml | 245 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 247 insertions(+), 241 deletions(-) diff --git a/core/numeric/convert.xml b/core/numeric/convert.xml index c5a056a2..f1d30b13 100644 --- a/core/numeric/convert.xml +++ b/core/numeric/convert.xml @@ -25,6 +25,8 @@ + + @@ -54,247 +56,6 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + +
From af0862f1f153a14fe3372c9ca2d9e99d50f056e5 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Mon, 2 Nov 2015 15:59:36 -0500 Subject: [PATCH 26/94] Percent package formatting --- core/numeric/convert.xml | 1 + core/numeric/percent.xml | 83 ++++++++++++++++++++++++++-------------- 2 files changed, 55 insertions(+), 29 deletions(-) diff --git a/core/numeric/convert.xml b/core/numeric/convert.xml index f1d30b13..d9c63103 100644 --- a/core/numeric/convert.xml +++ b/core/numeric/convert.xml @@ -26,6 +26,7 @@ + diff --git a/core/numeric/percent.xml b/core/numeric/percent.xml index 55f8dff8..3b30f305 100644 --- a/core/numeric/percent.xml +++ b/core/numeric/percent.xml @@ -140,12 +140,13 @@ - @@ -58,9 +66,11 @@ - - - + + + + + @@ -70,7 +80,7 @@ - + @@ -79,10 +89,12 @@ - - - - - + + + + + + +
From 1254141c0f4792e1433109550d888383e44dedec Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Fri, 6 Apr 2018 11:05:27 -0400 Subject: [PATCH 88/94] datetime: Assert on non-empty timestamp_current This won't be a problem in practice if nothing imports the package, so existing systems won't be affected. * datetime.xml: New assertion for timestamp_current. --- core/datetime.xml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/core/datetime.xml b/core/datetime.xml index b27e7710..76d0bb35 100644 --- a/core/datetime.xml +++ b/core/datetime.xml @@ -18,12 +18,16 @@ along with this program. If not, see . --> + xmlns:t="http://www.lovullo.com/rater/apply-template" + xmlns:c="http://www.lovullo.com/calc" + core="true" + desc="Date and time"> + + + Providing the current timestamp externally allows the system to be wholly deterministic. @@ -35,6 +39,11 @@ desc="Unix timestamp representing the current time of the system (clock time), as it should be perceived" /> + + + + + This system does not handle its own arthiemtic to figure out the current date components from the given timestamp. From 368b50d026f9bf8c3305f8d30f8ee7d192123fe3 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Fri, 15 Jun 2018 14:12:04 -0400 Subject: [PATCH 89/94] state.xml: Add state-all yield stateAll * state.xml (stateAll): New yield to state-all. --- core/state.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/state.xml b/core/state.xml index b56ab0ff..a7a5522c 100644 --- a/core/state.xml +++ b/core/state.xml @@ -187,7 +187,8 @@ - + From 6c4d0dae4ad38448cd5837ebb7031a0977dd3538 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 12 Jul 2018 16:41:03 -0400 Subject: [PATCH 90/94] base: Add maybe type * base.xml (maybe, nothing): New types. (boolean): Move into `maybe' as union member. --- core/base.xml | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/core/base.xml b/core/base.xml index 78b4ed0c..099055b4 100644 --- a/core/base.xml +++ b/core/base.xml @@ -80,14 +80,6 @@ - - - - - - - - \ref{empty} does not have much use outside of the compiler. +
+ \ref{boolean} contains the boolean \ref{TRUE} and~\ref{FALSE} values, + which map to~$1$ and~$0$ respectively. + The \ref{maybe} type is the union of \ref{boolean} and \ref{NOTHING}, + with a value of~$-1$;\footnote{ + This is similar in spirit to the Haskell \tt{Maybe} type, + or the OCaml \tt{Option} type. + }this is commonly used to represent an unknown state or missing + value.\footnote{ + The \ref{nothing}~type is used for the sake of the union; + it should not be used directly.} + + + + + + + + + + + + + + + + + + + The constant \ref{UNKNOWN} is also defined as~$-1$ to serve as an + alternative to the term~``nothing''. + + +
+ +
$0$~is a~common value. Where a value is required (such From 6a08ad7ed385ece9539b87a78fb9cd5dd8dfd491 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 30 Aug 2018 14:13:56 -0400 Subject: [PATCH 91/94] insurance: Add missing map export * insurance.xml: Add map import as export. --- core/insurance.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/core/insurance.xml b/core/insurance.xml index 1cbcacd2..eadf1ad3 100644 --- a/core/insurance.xml +++ b/core/insurance.xml @@ -26,6 +26,7 @@ + From 0e084c15046c301d823cbac928e38162af0c02c4 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 6 Sep 2018 15:20:08 -0400 Subject: [PATCH 92/94] insurance (_factor_): Permit @yields only * insurance.xml (_factor_): Permit @yields only. Otherwise, using a generator is required with these templates, which is not always desirable. --- core/insurance.xml | 71 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 15 deletions(-) diff --git a/core/insurance.xml b/core/insurance.xml index eadf1ad3..e2e100e8 100644 --- a/core/insurance.xml +++ b/core/insurance.xml @@ -126,16 +126,28 @@ There are special considerations for these types of values---% generally, they should not have a value of~$0$ if some sort of calculation condition or lookup is not met, - as that would have the effect of wiping out premium. + as that would have the effect of wiping out premium.\footnote{ + Note that every generator index can be non-zero but still sum up + to a zero yield, + which would trigger this error.} If zero is desired, \tt{@allow-zero@} must be set to \tt{true} to explicitly permit it. From 875ec7634f04fe025886c3f04927e9476c6cd4f5 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 6 Sep 2018 15:40:34 -0400 Subject: [PATCH 93/94] insurance (_factor_): Add @allow-negative * insurance.xml (_factor_)[@allow-negative@]: New param. --- core/insurance.xml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/core/insurance.xml b/core/insurance.xml index e2e100e8..c5203dd4 100644 --- a/core/insurance.xml +++ b/core/insurance.xml @@ -206,6 +206,12 @@ + + + false + + factor @@ -254,16 +260,32 @@ - + - + + + + + + + + + + + + + + + + From 2abdefb22a65606239c3904a41029e343fe6d289 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 6 Sep 2018 15:54:24 -0400 Subject: [PATCH 94/94] insurance: Add _credit_ and _debit_ * insurance.xml (_credit_, _debit_): New templates. --- core/insurance.xml | 132 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/core/insurance.xml b/core/insurance.xml index c5203dd4..64f93dc9 100644 --- a/core/insurance.xml +++ b/core/insurance.xml @@ -288,4 +288,136 @@ + + + The \ref{_credit_} and \ref{_debit_} templates define factors that are + intended to introduce, respectively, credits and surcharges. + Each name defined using these templates must be prefixed with ``credit'' + and ``debit'' respectively. + Credits must never exceed a value of~$1$, + as they would then be treated as if they were surcharges. + Similarly, debits must never have a value less than~$1$. + Both must have values greater than~$0$. + + If a value can be either a credit or a debit, + it is sometimes called an ``adjustment''. + In reality it is just another factor, + so just use \ref{_factor_} in such a~case. + + + + +