Commit Graph

249 Commits (4ddda94a4c61b7fa0b30eb7be89b49c0fae115e0)

Author SHA1 Message Date
Mike Gerwitz 4ddda94a4c 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.]
2018-09-11 09:30:48 -04:00
Mike Gerwitz f169c91927 expand: Correct priority of constant suffix templates
* src/current/include/preproc/expand.xsl (preproc:expand)[c:const]: Adjust
  priorities.
2018-09-10 15:37:17 -04:00
Mike Gerwitz 91316d1e8f js compiler: Escape exception string
* src/current/compiler/js.xsl (compile)[lv:classify]: Escape output for
  Error.
2018-09-07 14:25:24 -04:00
Mike Gerwitz d1e2b435a0 linker: >50% performance improvements in both time and space
This has a significant performance impact: processing time is cut in about
half and memory usage is reduced by more than 50%.  For example, a package
that previously took 30s and 2.1GiB of memory to link now takes 14s and less
than 900MiB of memory.
2018-07-16 08:44:39 -04:00
Mike Gerwitz ea7e0e1565 preproc: Remove @override from eseq:is-expandable function
This was throwing a warning in non-ancient versions of Saxon.  It does not
need to be there, nor should it be, nor do I know why it was put there.

* src/current/include/preproc/template.xsl (eseq:is-expandable): Remove
  @override.
2018-07-13 23:49:18 -04:00
Mike Gerwitz d624ee6d7e linker: Use sequences for stacks (instead of trees)
This has a significant performance impact: processing time is cut in about
half and memory usage is reduced by more than 50%.  For example, a
package that previously took 30s and 2.1GiB of memory to link now takes
14s and less than 900MiB of memory.

I had tried to perform this optimization a couple years ago but was
thwarted (I think) by the classifier markers.  The previous commit did away
with those.  I'm encouraged by the gains from the low-hanging fruit.

* src/current/compiler/linker.xsl
  (l:process-empty, l:stack-empty): Convert from l:pstack and
    l:sym-stack (respectively) to empty preproc:sym sequences.
  (l:depgen-process-sym)[preproc:sym]: Append to sequence rather than
    outputting new l:sym-stack tree.
  Update all annotations and uses accordingly.
2018-07-13 23:40:48 -04:00
Mike Gerwitz f2db9f1268 linker: Remove classifier vs. calculation distinction
This is something that I thought would be useful back in the day when TAME
was in its infancy, but it is not important.  Rather than having the linker
spend time trying to figure out what symbols belong in the classifier---and
rather than keeping that complexity around---this simplifies things by
making the existing `classify' method simply perform _all_ calculations, and
then yield only the classification portion of the result.

This isn't a problem in practice because, if we only desire the use of a
classifier, then we create a "supplier" that only uses classifications and
has no other dependencies.  The end result is, as far as we care, the same.

* src/current/compiler/js.xsl (compiler:entry-rater)[lv:package]: Initialize
    `classes' rather than invoking classifier
  (compiler:entry-classifier)[lv:package]: Invoke all calculations and
    return only classes to provide equivalent behavior.
  (compiler:exit-classifier): Post-process classifications from calculation
    results, iterating through classmap.
  (compiler:classifier-yields-map)[lv:package]: Output all classifications
    that are not generated.  This differs slightly from the original
    implementation in that it includes all non-generated classes rather than
    just classes that have a non-generated `@yields'; this distinction is
    important since `compiler:exit-classifier' is now using it to produce a
    classification result set that doesn't contain all the generated
    stuff (since it didn't before, and shouldn't now).
* src/current/compiler/linker.xsl: Update copyright year.
  (l:resolv-deps)[preproc:sym[@l:mark-inclass]]: Remove template.
  (l:resolv-deps)[preproc:sym...@l:mark-inclass...]: Remove template.
  (l:depgen-sym): Set type of result to `element(preproc:sym)', since
    `l:mark-inclass' is no longer produced.
    [inclass, needs-class-mark]: Remove variables and all instances where
      they are used.
  (l:dep-aug)[inclass]: Remove param.  Stop producing `@inclass' attribute.
  (l:link-classifier)[lv:package]: Do not process any dependencies.  This
    can be removed entirely in the future since it now only produces static
    code, which we can perhaps combine with a different block.
  (l:link-rater)[lv:package]: Remove mention of `inclass' for dependencies;
    all dependencies will now be compiled into this block.
2018-07-13 13:08:52 -04:00
Mike Gerwitz 844c6512c9 build-aux/gen-c1make: New build script
This solves the dependency-related problems with rebuilding c1map files.

* build-aux/gen-c1make: New file.
* build-aux/Makefile.2.in (suppliers.mk): Use it.
2018-07-05 16:07:42 -04:00
Mike Gerwitz 0453d78329 build-aux: Liberate remaining build scripts
These were forgotten during the initial liberation.

* build-aux/Makefile.2.in: New file.
* build-aux/Makefile.am: New file.
* build-aux/m4/calcdsl.m4: New file.
* build-aux/progtest-runner: New file.
* build-aux/suppmk-gen: New file.
2018-07-05 16:04:33 -04:00
Gregory Torbenson 9889838c5e Merge branch 'jira-3251' into 'master'
[DEV-3251] add escape-param attribute to tame

See merge request floss/tame!19
2018-07-02 15:04:29 -04:00
Greg Torbenson 84f9321a4d [DEV-3251] factor escape check out to a function, and also fix a bug. 2018-07-02 10:27:53 -04:00
Greg Torbenson 5cbffa9c10 remove debug code 2018-06-29 17:15:00 -04:00
Shelly Shaver c2504d89c0 add support for escape-param attr 2018-06-29 17:14:57 -04:00
Greg Torbenson fc60f98908 Don't break interpolated comparison attributes when fixing static comparisons. 2018-06-27 14:03:38 -04:00
Taylor Cordes 9333c66cad Merge branch 'jira-3245' 2018-06-26 10:27:21 -04:00
Taylor Cordes badb1a59f8 [DEV-3245] fixed bug preventing second paramater in conditionals 2018-06-26 09:06:50 -04:00
Taylor Cordes 1628cc0aa6 Revert "fixed bug preventing second parameter in conditionals"
This reverts commit 80ed214e12.
2018-06-25 16:21:12 -04:00
Taylor Cordes 80ed214e12 fixed bug preventing second parameter in conditionals 2018-06-25 14:16:32 -04:00
Mike Gerwitz 1fe35cd354 Add list2typedef and map hash support 2018-05-29 15:54:59 -04:00
Mike Gerwitz eef3eb85ea map: Uppercase and hash transformers
This includes a SHA256 implementation which is _not_ intended for secure
cryptographic operations; see src/js/sha256.js header for more information.

* src/current/compiler/js.xsl (compiler:static): Echo src/js/sha256.js.
  [map_method_uppercase, map_method_hash]: New functions.
* src/current/link.xsl: Include dslc-base.xsl.
* src/js/sha256.js: New file.
2018-05-29 11:16:59 -04:00
Mike Gerwitz 3f7e1fc9b8 map: Add transformation support
* src/current/compiler/map.xsl
  (lvmc:get-method-func, lvmc:value-ref, lvmc:transformation-wrap): New
    functions, partyl extracted from below.
  (lvmc:compile)[lvm:map//lvm:from]: Use `lvmc:value-ref'.
    [lvm:map//lvm:from/lvm:translate]: Add `[@key]' to match.
    [lvm:map//lvm:transform]: New match.  Ignore node entirely.
  (lvmc:concat-compile): Propagate symtable to `lvmc:compile'.
2018-05-29 10:53:48 -04:00
Mike Gerwitz 2a9196d940 Add __path-root param
* src/current/include/dslc-base.xsl (__path-root): New param.
* src/current/src/com/lovullo/dslc/DslCompiler.java
  (DslCompiler)[compile]: Resolve TAME root path.
    [_transform]: Set it.

DEV-3115
2018-05-29 10:50:53 -04:00
Mike Gerwitz fafbf3921e list2typedef: Remove trailing newline from preimage
Oops---we do not want a newline as part of the preimage, which is what
`<<<' does.

* build-aux/list2typedef (output-item)[value]: Remove newline from preimage.
* build-aux/test/test-list2typedef (test-typedef-gen): Update hashes.
  (test-collision-value-check): Add new collisions.
2018-05-15 16:47:21 -04:00
Mike Gerwitz e3b0baec1a Cut down on namespace exports for object files
This should cut down on the file sizes a bit.
2018-05-15 13:03:38 -04:00
Greg Torbenson f2e3cdf5f7 Modify valparse to recurse into the RHS. 2018-05-09 12:07:57 -04:00
Mike Gerwitz e764141b71 Add typelist support 2018-05-07 16:22:29 -04:00
Mike Gerwitz 5cce3a6eeb [DEV-3115] gen-make: Account for typelist
This needs to be generalized, but will do for now.

* build-aux/gen-make: Recognize typelists as dependencies.  Always include
  source XML file as a dependency.
2018-05-07 16:22:18 -04:00
Mike Gerwitz 34844a650a [DEV-3115] build-aux/list2typedef: New script
* build-aux/list2typedef: New script.
* build-aux/list2typedef/test/test-list2typedef: Respective test.
2018-05-07 13:57:50 -04:00
Mike Gerwitz c271ee696e build-aux/gen-make: Recurse without dir change
Before this change, it was impossible for the initial paths provided to the
script to be more than one level deep (relative to the cwd).

* build-aux/gen-make: Handle multi-level children.
2018-05-04 11:41:54 -04:00
Mike Gerwitz 70f9e9c277 Move {src/current/tools=>build-aux}/* 2018-05-04 11:17:47 -04:00
Mike Gerwitz 612587c63f Map support for set/from to generate arbitrary vectors 2018-04-16 11:20:46 -04:00
Mike Gerwitz 4554013356 map: Support @index on all lvm:from
* src/current/compiler/map.xsl (lvmc:compile)[lvm:map//lvm:from[*]]: Output
    index if @index is set.
2018-04-16 11:11:21 -04:00
Mike Gerwitz ba1faa74da map: Support `from' within `set'
This was just a matter of proxying `type'.

* src/current/compiler/map.xsl (lvmc:compile): Proxy `type' param.
2018-04-16 11:11:19 -04:00
Mike Gerwitz 6a45b2c95a map: Tunnel symtable
Simplifies coming changes.

* src/current/compiler/map.xsl: Tunnel all `symtable' params.
2018-04-11 14:28:11 -04:00
Mike Gerwitz 2c29c295fe progtest: ConsoleTestReporter: Correct number of inds on first line 2018-04-10 15:56:50 -04:00
Mike Gerwitz 42d192af79 progtest: Exit with non-zero status on test failure
Not a very useful test runner if it doesn't ever fail, now is it?

* Makefile.am (check): Invoke new test/runner-test.  Depend on modindex.
* bin/runner.js: Exit with non-zero status on assertion failure.
* test/_stub: Add stub program with good and bad test cases to test
    exit code.
* test/runner-test: Add system test.
2018-04-10 15:56:38 -04:00
Mike Gerwitz 8a17d0c6c5 c1map: Add lvm:when
This allows for conditional nodes where lvm:if is not appropriate or cannot be
used.
2018-04-06 15:03:32 -04:00
Mike Gerwitz 6d0f4fd458 c1map: Prevent iteration on conditionals
This does not work at all.
2018-04-06 14:56:35 -04:00
Mike Gerwitz 986b2a7b4b map: Provide useful warnings when missing import/@path
This is all really confusing because this doesn't use the same import
specification as packages; maps got stuck in a partial transition.  So,
let's provide some helpful errors rather than silently failing.

* src/current/compiler/map.xsl (preproc:symtable)[lvm:import]:
    Error if missing `@path'.  Provide more information if `@package' was
    provided to help clarify.
2018-04-05 15:53:54 -04:00
Mike Gerwitz c15ed8a2cd Add class, param, const, rate to param-value/@identifier
* src/current/include/preproc/template.xsl
  (preproc:gen-param-value-style)[lv:param-value[@identifier]]: Add support
  for class, param, const, rate styling.
2018-04-02 12:40:50 -04:00
Mike Gerwitz 189751d5cc Mark generated symbols as local
We need to cut down on symbol imports as much as possible; the whole system
starts dragging if we are importing thousands of symbols into a single
package.

* src/current/include/preproc/symtable.xsl (preproc:symtable)[lv:rate,c:*]: Mark
  as local if `@preproc:generated`.
* src/current/include/preproc/template.xsl (preproc:macros)[lv:inline-template]:
  Mark generated templates as such.
* src/symtable/symbols.xsl (preproc:symtable)[lv:template]: Mark as local if
  `@preproc:generated'.
2018-03-28 14:22:57 -04:00
Mike Gerwitz 852c42e340 symtable: Detect duplicate symbols in the same package
* src/symtable.xsl (symtable:find-duplicates):
  Update description.  Find duplicates in same package.
* test/symtable.xspec: Update test case accordingly.
2018-03-28 10:30:15 -04:00
Mike Gerwitz d284d75f39 js compiler: Prevent octals in generated code
* src/current/compiler/js.xsl (compiler:js-number): New function to
    remove leading zeroes.
  (compile)[lv:const]: Use it.
* src/current/compiler/js-calc.xsl (compile-calc)[c:const]: Use it.
2018-03-28 10:30:12 -04:00
Shelly Shaver 67d0cd69ec c1map: Add lvm:if/@eq 2018-03-21 14:46:10 -04:00
Mike Gerwitz a3fcaa8737 rate-each: Gentle @no
* src/current/compiler/js.xsl (compile-class-condtion)[lv:rate]: Do not
  consider @no's in predicate generation when `@preproc:gentle-no' is set.
* src/current/include/preproc/macros.xsl (preproc:macros)[lv:rate-each]: Set
  `@preproc:gentle-no' on generated `lv:rate', since the generator handles
  `@no' itself.
2018-03-19 15:23:41 -04:00
Mike Gerwitz 2960f2d0b3 linker, summary: Reduce runlog output 2018-03-19 15:08:17 -04:00
Mike Gerwitz 5b5055db6d preproc/template: Add param-sym-value/@ignore-missing
* src/current/include/preproc/template.xsl
  (preproc:gen-param-value)[lv:param-sym-value]: Suppress warning for
  missing symbol and yield empty string if `@ignore-missing='true'`.
2018-03-16 16:24:06 -04:00
Mike Gerwitz afc1a2038a progtest: Suppress terminating classifications during const run
Terminating classifications will occur any time there is actual data
validation, since we're passing no data at all.

* progtest/src/env.js (common): Pass argument to program#rater to suppress
  terminating classifications.
2018-03-06 14:16:32 -05:00
Mike Gerwitz 0d169ea9eb progtest: Return empty array of test cases if none provided
* progtest/src/reader/YamlTestReader.js (loadCases): Handle absence of any
  test cases.
* progtest/test/reader/YamlTestReaderTest.js: New respective test.
2018-03-06 11:41:21 -05:00
Mike Gerwitz 0cb43d5e8a progtest: Do not run tests async on console
Performance hit is too great; automated tests need to be _fast_!

* src/AsyncTestRunner.js: New TestRunner subtype.
* src/TestRunner.js (_runAsync): Rename to virtual protected
  `runAllTests'; this method is overridden by aforementioned subtype.
* src/env.js: Use it.
2018-03-05 16:24:53 -05:00