Commit Graph

352 Commits (main)

Author SHA1 Message Date
Mike Gerwitz e022a3133d Copyright year simplification and update to Ryan Specialty Group
This now uses year ranges, which I'll update annually.

This also renames "R-T Specialty" to "Ryan Specialty Group".  The latter is
the parent company of the former.  I was originally employed under the
former when LoVullo Associates was purchased, by I now work for the parent
company.
2019-02-07 13:23:09 -05:00
Mike Gerwitz 7862eef62e summary: Accommodate now-missing dependency lists
The previous commit made dependency lists optional for certain symbols.  The
Summary Page needs to be updated to permit such a thing.

The whole Summary Page needs aggressive refactoring, though, so this doesn't
bother checking for `no-deps' to see if this is a bad thing.

* src/current/summary.xsl (typeset-final)[preproc:sym-ref]: Permit missing
    symbol dependencies.
  (lv:param|lv:const|lv:item): Likewise.
2019-02-07 13:11:31 -05:00
Mike Gerwitz b6cfdb4221 depgen: Quadratic=>linear-time algorithm
This is a significant performance improvement for dependency
generation (which is responsible for building the dependency graph for a
package).

The previous algorithm ran in O(n²) time: it would iterate over the given
symbol table, and for _each_ symbol, do a linear scan of the entire document
to search for the corresponding source block.  This resulted in explosive
depgen time for larger packages.

This makes the algorithm run in O(n) by:
  - Using an XSLT 3 map for the symbol table for O(1) lookups; and
  - Iterating over the _document_ a single time rather than the symbol
    table, referencing the symbol table as needed (in O(1) time).

There are other parts of the system that can benefit from these same
improvements.  This is important, since we need to be able to handle many
thousands of symbols efficiently.

* src/current/compiler/linker.xsl (l:depgen-sym): Recognize smybol `no-deps'
    property, permitting missing dependencies.  This allows us to avoid
    creating nonsense nodes just to satisfy the linker, while still allowing
    the linker to perform essential checks to defend against compiler bugs.
* src/current/compiler/map.xsl (lvmc:stub-symtable): Set @no-deps on
    `___head' and `___tail' symbols.
  (lvmc:mapsym): Set `no-deps' as appropriate on map symbols.
  (preproc:depgen)[lvm:map[@from]]: Generate `preproc:sym-dep' node, which
    is now expected by the depgen process.
  (preproc:depgen)[lvm:map[*]]: Likewise.
  (preproc:depgen)[*[@lvmc:type='retmap']//lvmm:map[@from]]: Remove
    unnecessary template.
  (preproc:symtable)[lvm:map[@value]]: Pass `no-deps' to `lvmc:mapsym'.
* src/current/include/depgen.xsl (preproc:depgen)[preproc:symtable]: Create
    and use XSLT 3 map in place of `preproc:symtable' tree.  This allows for
    constant-time lookups.  Provide to templates via tunnelling.  Use it in
    place of exiting tree references.  Process source tree rather than
    iterating over symbol table.
  (preproc:depgen)[lv:rate, c:sum[@generates], c:product[@generates],
    lv:classify, lv:function/lv:param, lv:function, lv:typedef]: Produce
      `preproc:sym-dep' nodes (which was previously done while iterating
      over the symbol table).
  (preproc:depgen)[preproc:sym]: Remove all such processing, since we no
    longer iterate over the symbol table.
  (preproc:depgen)[c:value-of]: Use symtable map.
  (preproc:depgen-match): Likewise.
  (preproc:depgen)[lv:union]: Modify to handle changes to lv:typedef
    template.
  (preproc:depgen)[text()]: Remove and replace with `node()'.
* src/current/include/preproc/package.xsl (preproc:resolv-syms): Remove
    logging of symbol resolution.  This has a slight performace impact since
    there is a lot of output.
* src/current/include/preproc/symtable.xsl
  (lv:function/lv:param, c:let/c:Values/c:value): Set `no-deps'.
* src/symtable/symbols.xsl: Add documentation of `no-deps'.
  (preproc:symtable)[lv:meta]: Set `no-deps'.
2019-02-07 11:39:50 -05:00
Mike Gerwitz 11109d4361 core: Add _where-*_ query predicate templates
These provide a more pleasent abstraction than having to reference CMP_OP_*
constants.

* core/test/core/vector/interpolate.xml: {t:when=>t:where-eq}.
* core/test/core/vector/table.xml: Likewise, but using the other variants
    where appropriate given the value of `@op'.
* core/vector/interpolate.xml: Likewise.
* core/vector/table.xml (_when_, _where_): Rename former to latter and
    provide deprecation warning.
  (_when-lt_, _when-lte_, _when-gt_, _when-gte_): Add abstractions.
* src/current/rater.xsd: Permit template variable as tenplate name.
2019-02-04 10:22:46 -05:00
Mike Gerwitz 9af38261b9 calc.xsd: Permit template applications within c:value-of
* src/current/calc.xsd (valueType): Permit ##other nodes.
2019-02-04 10:22:46 -05:00
Mike Gerwitz a35844f3fb depgen: Do not recurse into templates
Same logic, more efficient implementation.

* src/current/include/depgen.xsl (preproc:depgen): Stop at lv:template.
2019-02-02 23:19:40 -05:00
Mike Gerwitz 07e5dbd94b Add expand-barrier and skip-child-expansion
It's going to be like TeX before you know it... ._.

* src/current/include/preproc/package.xsl (preproc:tpl-check)
  [lv:template|lv:const|lv:typedef|lv:param-copy]: Add lv:param-copy.
* src/current/include/preproc/template.xsl (preproc:apply-template)
 [lv:expand-barrier, lv:skip-child-expansion]: New expansion control
   structures.
2019-02-01 16:01:56 -05:00
Mike Gerwitz 7ac4c1ce9d Template variable expansion on (lv:param-value|lv:param-inherit)/@name
This allows for dynamically generated metadata names.

* src/current/include/preproc/template.xsl (preproc:apply-template)
  [lv:param-meta]: Expand @name.
  [lv:param-inherit]: Expand @meta.
2019-02-01 16:01:56 -05:00
Mike Gerwitz f719d391c7 Default short-hand constant description to c:value-of/@label
This is a much more useful description if present.

* src/current/include/preproc/macros.xsl (preproc:macros)[c:value-of...]:
    Default generated constant description to @label.
2019-02-01 16:01:56 -05:00
Mike Gerwitz b725963722 Add c:vector as c:set alternative
The term "set" is all wrong---it is actally intended to be a vector, and can
absolutely have duplicate elements (and often does).

* src/current/calc.xsd (vector): Add, recommending in place of `set'.
* src/current/compiler/js-calc.xsl (compile-calc)[c:set|c:vector]:
    Add `c:vector' and provide deprecation notice for `c:set'.
* src/current/include/calc-display.xsl (c:set|c:vector): Likewise.
2019-02-01 16:01:56 -05:00
Mike Gerwitz 304faa1f07 summary: Remove rate-group processing
* src/current/summary.css (.rate-group, .rate-groups): Remove.
* src/current/summary.xsl (gen-menu): Remove rate-group processing.
  (rate-group-title): Remove.
  (lv:rate-group): Remove.
2019-02-01 16:01:56 -05:00
Mike Gerwitz 22aa59b5cf map: Properly default value in translation
A better option is to pre-process all inputs, but I need a quick
fix to my stupidity.  0||""==="".

* src/current/compiler/map.xsl (lvmc:compile)[lvm:map//lvm:from[*]]: Correct oval default.
2019-02-01 16:01:56 -05:00
Mike Gerwitz 01a420fd81 Revert "set_default: Allow empty vectors"
I need to revert this for now because it breaks YAML test cases.  The proper
fix is a more expressive type system with dependent types that would allow
it to know the proper number of indexes to initialize relative to other
inputs.  I wanted to implement this anyway to help catch iteration-related
bugs.

I'm tabling this for now, though, since I have other things that I need to
work on.

This reverts commit 4406cbe553.
2019-01-30 13:45:17 -05:00
Mike Gerwitz f3aa38a0c1 doc: Convert most sections index appendicies
I want this manual to be useful both to developers and users of TAME,
so this distinction needs to be made clear.

* doc/tame.texi (Preprocessor): chapter=>appendix.
* src/graph.texi: Top to appendix and raise subsections.
* src/symtable.texi: Top to appendix.
2019-01-29 15:38:00 -05:00
Mike Gerwitz 4406cbe553 set_default: Allow empty vectors
This is an assumption that's existed since the Summary Page was first
devised---that all vectors have at least one value.  This is because the
bucket (originating from Liza) always has at least one value in its vectors.

Of course, we still have a problem in that the Summary Page initializes
everything to have a single value by default, and that's still the
case.  But this will at least allow for things _outside_ the Summary Page to
provide an empty array.  I'll have to address the Summary Page separately,
and that's going to be difficult, since we don't really want to change the
behavior across the board.

* src/current/compiler/js.xsl (set_defaults): Default max index to 0 if
    `length' is unavailable, rather than 1.
2019-01-29 10:07:36 -05:00
Mike Gerwitz c9ab302f53 map: Proper array check for translation iteration
The previous length check existed as a really bad array check (before
Array.isArray was a thing).  This has been broken since Nov 2012.

The problem manifests itself when you want an empty array.  We then have:
  [] => [[]] => [DEFAULT_VALUE]

* src/current/compiler/map.xsl (lvmc:compile)[lvm:map//lvm:from[*]]: Use
    `Array.isArray' in place of length check.
2019-01-28 14:15:10 -05:00
Mike Gerwitz c3c7cfeeff map.xsl: Escape all output in strings 2018-12-20 14:31:14 -05:00
Mike Gerwitz c7e84f2e29 DslCompiler: Use s9api instead of JAXP
The difference is described here:

  http://www.saxonica.com/html/documentation/using-xsl/embedding/

And s9api here:

  http://www.saxonica.com/html/documentation/using-xsl/embedding/s9api-transformation.html

* Makefile.am (DSLC_CLASSPATH): Export for submakes.
* configure.ac (DSLC_CLASSPATH): Prefix with SAXON_CP.
* rater/rater.xsd (classNameType): Increase length 50=>75 (generated
    identifiers can now exceed that, it seems).
* src/current/rater.xsd: Likewise.  These files need to be combined.
* src/current/src/Makefile (CLASSPATH): Set to DSLC_CLASSPATH.
* src/current/src/com/lovullo/dslc/DslCompiler.java: Update imports.
  (DslCompiler)[_DslCompiler]: New members _processor and
    _xsltCompiler.  Convert to s9api.
2018-12-18 13:33:25 -05:00
Mike Gerwitz 219a4b521a summary: Remove reset button
This has been broken for years.  I don't object to fixing it, it's just that
I have better things to do right now and we've gotten complaints about it;
no use in keeping around something that's broken if there's no desire to fix
it.  Workaround: refresh the page.

This does keep around the reset logic because it is actually used in other
places.

* src/current/include/entry-form.xsl (entry-form)[lv:package]: Remove reset
    button.
* src/current/include/entry-form.js (clearTestCases): Remove broken function
    call `Prior.setPriorMessage(null)'.
2018-12-05 10:21:25 -05:00
Mike Gerwitz bcd8a67bd9 summary: Sans-serif font stack
It wasn't until recently that I realized that the default browser font was
being used, since I have mine customized.

* src/current/summary.css (body)[font-family]: Sans-serif font stack.
2018-12-05 10:14:08 -05:00
Mike Gerwitz fe14db7379 map: Correctly set translation defaults given the symbol dimensions
* src/current/compiler/map.xsl:
  (lvmc:gen-input-default): Add argument.
    [dim]: New param, defaulting to `$sym/@dim'.
  (lvmc:compile)[lvm:map//lvm:from[*]]: Provide appropriate dimension value
    to `set_defaults'.  Provide compile-time error if nesting of `from'
    nodes exceeds what is appropriate for the symbol dimensions.
2018-12-04 16:56:53 -05:00
Mike Gerwitz 6e4d42f926 DslCompiler: Properly output errors and termination line
This fixes a number of obnoxious miscellaneous issues, summarized below.

* src/current/src/com/lovullo/dslc/DslCompiler.java (DslCompiler)[compile]:
    Output termination line (DONE) on missing destination path
    error.  Always output exception message before termination
    line (otherwise it won't output to the user).  Output termination line
    and remove destination file for XSD failure.
2018-12-04 13:45:46 -05:00
Mike Gerwitz 10106993b5 map: Always terminate on missing destination symbol
This was a bit of a nasty one.  Fortunately, this was only used as a
validation, so the code that the compiler produced was still correct.

The problem was that a version of Saxon sometime between 9.5 and 9.8 added
an optimization to eliminate conditionals with no body.  Consequently, the
kluge to force the variable to be evaluated was optimized away,
`lvmc:get-symbol' was never called, and no error was ever produced.

This would be best refactored, but that's not something I have time to take
up at the moment priority-wise.  This should be future-proof since this
would never be a noop.

* src/current/compiler/map.xsl (lvmc:compile)[lvm:map//lvm:from[*]]: Force
    evaluation of `$sym' by ensuring that the condition will not be a noop.
2018-12-04 12:06:40 -05:00
Mike Gerwitz 210693c22f [DEV-3958] c1map: Make output PHP namespace configurable
* src/current/c1map.xsl (lvm:c1map): Copy `@namespace' to generated
    `lvmp:root'.
* src/current/c1map/render.xsl (lvmp:render)[lvmp:root]: Output
    `@namespace' rather than using hardcoded string and dynamic program.
2018-11-28 16:42:04 -05:00
Mike Gerwitz 7f3e279cfa anyValue: Always yield a matrix if any predicate is a matrix
This is a long-standing bug, apparently.  The location of this code makes it
difficult to test directly (that is in dire need of correcting), but
fortunately we have a number of tests in systems that use TAME that
indirectly test this.

The problem manifested when a matrix was already in the store, but then a
scalar or vector predicate was considered.  Without making the branch that
was modified here, it modified store such that it would always yield a
vector.

* src/current/compiler/js.xsl (anyValue): Consider store dimension when
    recursing.
2018-11-21 15:19:44 -05:00
Mike Gerwitz 5cb78cc47d dslc: Invoke with static rater path
This frees us from requiring a rater/ directory in the working
directory.  However, it is important that we continue using it if it
exists, since there are additional things that haven't yet been moved
into the tame repo.

* bin/dslc.in: Provide path to rater/ directory.
* src/current/src/com/lovullo/dslc/DslCompiler.java: Use provided rater/ path.
2018-11-08 09:26:07 -05:00
Mike Gerwitz 8143207903 Support non-xmlo dependencies for input map @src
* build-aux/gen-make: Do not add ".xmlo" suffix for deps with a
    trailing `$'.
* src/current/pkg-dep.xsl (lvm:program|lvm:return-map): Append ".xml$" to
    dep for map/@src (new dep).
2018-10-19 10:15:11 -04:00
Mike Gerwitz 1e5cdf8c40 src/current/src/Makefile: Phony recursive targets
Otherwise *-recursive fails.

* src/current/src/Makefile (check, info, pdf, html): New phony targets.
2018-10-16 09:10:15 -04:00
Mike Gerwitz 6027769633 Integrate new compilation scripts, remove cqueue and Makefile.2
This is a major step toward normalcy---removing the kluge of a build process
that was causing so many issues.  Rather than echoing all operations to a
queue file before passing it off to dslc, the new build scripts in `bin/'
are used to invoke tame normally, as needed.  This solves all of the current
issues with things not rebuilding when they should.  And, as a bonus, tab
completion on targets works.

Sorry this took so long.  There wasn't much motivation until we hired so
many people that are suffering from this.

This does a few major things, along with some miscellaneous others:
  - Invoke bin/tame directly;
  - Merge Makefile.2.in into Makefile.am; and
  - Fix up some targets.

* build-aux/Makefile.2.in: Delete file.  Mostly merged with Makefile.am.
* build-aux/Makefile.am: Add a bunch of new targets and definitions from
    Makefile.2.in.  Modify all that previously used .cqueue to now invoke
    `$(TAME)' directly.  Remove miscellaneous targets for trying to proxy
    targets to Makefile.2.
  (saneout, _go): Remove definitions.
  (.NOTPARALLEL): Add to prevent parallel builds.
  (ui/program.expanded.xml)[.version.xml]: Remove dependency for now.
  (clean): Also clean generated PHP files.  Follow symlinks to clean core.
    This is still incomplete (does not clean all rate table stuff).
  (suppliers.mk)[xmlo_cmd]: Remove.  See `gen-make' and `gen-c1make'.
  (lvroot)[summary-html]: New dependency.
  (kill-tamed, tamed-die): New targets (former alias of latter) to kill
    tamed.
* build-aux/gen-c1make: Generate `$(TAME)' invocation.
* build-aux/gen-make: Likewise.  Remove `xmlo_cmd' output.  Ignore recursive
    `tame' symlink (this can be removed once we clean `rater/' up.
* build-aux/m4/calcdsl.m4 (TAME): Update description to reflect that it
    should now be the path to `bin/tame'.  Adjust `AC_CHECK_FILE' lines
    accordingly.
  (tame_needed_ver): Remove.  We have been in the same repo as TAME itself
    for quite some time.  Remove associated code.
  (AC_CONFIG_FILES): Remove `Makefile.2'.
* src/current/src/com/lovullo/dslc/DslCompiler.java (_DslCompiler)[compile]:
    Perform validation prefore `compile' command rather than a separate
    `validate' step.  Remove `rm'.
  [compileSrc]: Stop echoing command.  This was only necessary because of
    the previous Makefile klugery; now Make echoes on its own correctly.
2018-10-11 22:25:18 -04:00
Mike Gerwitz 88da519c5e template.xsl: Remove eseq:expand-node function @override
* src/current/include/preproc/template.xsl (eseq:expand-node)[@override]:
  Remove attribute (deprecated by Saxon and unneeded).
2018-10-11 21:03:51 -04:00
Mike Gerwitz cf57857ce5 bin/: Server/client build scripts
These scripts allow the TAME compiler stack to be invoked naturally, rather
than requiring the use of a Makefile today.  This will not only allow users
to more easily invoke the compiler, but will also allow us to invoke TAME
naturally from Makefile and remove the klugery that has existed for so
long.

This users a server/client architecture in order to mitigate the startup
cost of the JVM.  More documentation will follow.

Note that there are a bunch of symlinks in rater/---this is a transition
step to allow the build to continue working as it did before, which relies
on a directory structure that exists outside of this repository.  This will
be cleaned up in the future.

* .gitignore (bin/dslc): Add ignore for generated file.
* bin/dslc.in: New script to encapsulate Java invocation.
* bin/tame: New script (client).
* bin/tamed: New script (server).
* configure.ac (JAVA_OPTS, DSLC_CLASSPATH, AUTOGENERATED): New variables for
  dslc.in.  Output bin/dslc.
* rater/README.md: Note that this symlink mess is temporary.
* rater/c1map: New symlink for dslc assumptions.
* rater/c1map.xsl: Likewise.
* rater/calc.xsd: Likewise.
* rater/compile.xsl: Likewise.
* rater/compiler: Likewise.
* rater/dot.xsl: Likewise.
* rater/include: Likewise.
* rater/link.xsl: Likewise.
* rater/standalone.xsl: Likewise.
* rater/summary.xsl: Likewise.
* rater/tame: Likewise (warning: circular symlink).
* src/current/src/com/lovullo/dslc/DslCompiler.java (_DslCompiler)[compile]:
  Output `DONE' lines.
2018-10-08 23:25:02 -04:00
Mike Gerwitz 4ad0c5d1be Include dslc Java build as submake
This will now automatically build on recursive target `all'.

* Makefile.am (SUBDIRS): Add `src/current/src'.
* src/current/src/Makefile: (.PHONY): Add `all'.
  (all): New target.  Alias to `dslc'.
2018-10-08 23:07:41 -04:00
Mike Gerwitz 607abd281d expand-sequence: Fix TeX escaping
* src/preproc/expand/expand-sequence.xsl: {\\=>\}.
2018-09-12 16:51:11 -04:00
Mike Gerwitz e18d5bb4b5 symbols: Remove last remnants of @keep
* src/symtable/symbols.xsl (preproc:symtable)[lv:param]: Remove @keep.
* test/symtable/symbols.xspec: Remove @keep.
2018-09-12 12:07:25 -04:00
Mike Gerwitz ed5f3d151e Add src/ symlink to doc/
Most LaTeX distributions prohibit loading files from parent
directories.  This gets around that for PDF builds.

* doc/src: Add symlink.
* doc/tame.texi, src/symtrable.xsl: Use it.
2018-09-12 12:07:25 -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 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
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 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 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 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 70f9e9c277 Move {src/current/tools=>build-aux}/* 2018-05-04 11:17:47 -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 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 abca20b02d depgen: Include enum constants as typedef dependencies
This ensures that they are compiled into the `consts' object.

* src/current/include/depgen.xsl (preproc:depgen)[lv:typedef]: Include
  `lv:enum/lv:item/@name' as dependencies.
2018-02-28 15:29:49 -05:00
Mike Gerwitz b70cbb9eae standlone: Correct consts reference for worksheet
This was broken in 0c020b7.

* src/current/standalone.xsl (/): {rater_results=>rater}.consts.
2018-02-26 10:39:03 -05:00
Mike Gerwitz 5b256e0268 symtable: Do not mark symbols with generated yields as generated
The problem with this implementation was that, any time a generator had an
associated generated @yields (which is common), it wouldn't be included in
the summary page.

We can address this in the future.  It's not necessarily that it was
incorrect; it's just how the system made use of it.

* src/current/include/preproc/symtable.xsl (preproc:symtable)[lv:rate]:
  Do not mark @preproc:yields-generated symbols as @preproc:generated.
2018-02-26 10:31:04 -05:00
Mike Gerwitz d8cbee12b2 validtor: Remove unresolved extern warning
See diff comment.

* src/current/compiler/validate.xsl (lvv:validate)[c:*[@name or @of]]:
  Remove unresolved extern warning.
2018-02-26 10:30:42 -05:00
Mike Gerwitz 6b7e75c886 entry-form: Integrate YAML test case console output as HTML 2018-02-23 14:20:16 -05:00
Mike Gerwitz 3bf15ebcc1 depgen: Ignore template bodies
Templates can expand into unexpected places, so sometimes warnings are
inappropriately issued.

* src/current/include/depgen.xsl (preproc:depgen)[lv:template]: Ignore.
  [lv:template/lv:param]: Remove (now unnecessary with above).
2018-02-23 13:45:07 -05:00
Mike Gerwitz 3384c95bc9 Revert "program map: Use expanded (preprocessed) program"
This map is used for more than the program.xml!

This reverts commit c64e8363fd.
2018-02-22 16:42:26 -05:00
Mike Gerwitz c64e8363fd program map: Use expanded (preprocessed) program
* src/current/compiler/map.xsl (lvmc:compile)[lvm:program-map]: Use
  `program.expanded', which is the preprocessed output.
2018-02-22 16:25:10 -05:00
Mike Gerwitz 4b1a72db81 entry-form: Clear YAML filename after loading
This way the test case can be re-loaded; otherwise it is
not recognized as a change and does not trigger the event.
2018-02-19 15:21:14 -05:00
Mike Gerwitz a52cbcea41 Correct param initialization 2018-02-19 15:21:14 -05:00
Mike Gerwitz 4e3a86866a progtest: Display reader errors in browser 2018-02-19 15:21:14 -05:00
Mike Gerwitz f788edd675 Initial embedding of YAML test case runner 2018-02-19 15:21:14 -05:00
Mike Gerwitz 0c020b736d Produce consts as part of rater object 2018-02-19 15:21:14 -05:00
Mike Gerwitz 7f26db41b2 Properly re-order classification predicates of any dimension
In order for the cmatch algorithm to work properly, predicates must be
re-ordered on @dim descending.

* src/current/compiler/js.xsl (compile)[lv:classify]: Order all different
  dimensions, not just scalars.
2018-02-19 13:56:08 -05:00
Mike Gerwitz 34b82e7f7e preproc: Fix lv:any-only conversion broken from last commit
Gah.

This system really needs tests.
2018-02-19 11:41:27 -05:00
Mike Gerwitz 1f545a11ff preproc: Expand templates in extracted classes
any/all blocks within classifications are extracted into their own
classifications.  When they have sibling nodes, the extracted
classifications did not have their templates expanded.  Ouch.
2018-02-19 11:30:49 -05:00
Mike Gerwitz f15a1bb063 Copyright update (R-T Specialty) 2018-02-01 13:11:52 -05:00
Mike Gerwitz cac38d5e06 lv:rate/@generates: Validation error (bugfix)
* src/current/compiler/validate.xsl (lvv:validate)[lv:rate[@generates]]:
  Throw validation error.
2018-02-01 13:08:03 -05:00
Mike Gerwitz c5fcc3ccd2 template: Add prefix and suffix conditional support (feature)
* src/current/include/preproc/template.xsl (preproc:apply-template-cmp): Add
  @prefix and @suffix.
2018-02-01 13:08:03 -05:00
Mike Gerwitz c0370690f4 validate: Error on nested rate blocks (bugfix)
* src/current/compiler/validate.xsl (lvv:validate)
    [lv:rate[ancestor::lv:rate]]: Error on nested rate block.
2018-02-01 13:08:03 -05:00
Mike Gerwitz 9c4fbdace9 symtable: Only consider first lv:rate ancestor for parent (bugfix)
This is a situation that should never happen (I haven't yet determined
whether or not we should support this type of thing in the future), but when
it does, do something intelligent.

* src/current/include/preproc/symtable.xsl (preproc:symtable)[c:*[@generates]]:
  Consider only first ancestor lv:rate.
2018-02-01 13:07:51 -05:00
Mike Gerwitz b36cc3a942 c:sum/@of: Support let values
It's not good that c:let is still doing its own logic for this.

* src/current/compiler/js-calc.xsl (compile-calc)[c:sum[@of]]: Support c:let
  values.
2018-01-30 12:10:11 -05:00
Mike Gerwitz f2a9cd6af8 calc.xsd: Allow ##other in consts
* src/current/calc.xsd (constType): Allow ##other
2018-01-29 16:30:56 -05:00
Mike Gerwitz 9747d16464 Permit matrix reference in c:length-of (bugfix)
* src/current/compiler/validate.xsl (lvv:validate)[c:value]: Allow direct
  matrix reference (without index) in `c:length-of'.
2018-01-29 13:14:02 -05:00
Mike Gerwitz 440b935dc0 Display error on non-scalar constant lv:match/@value (bugfix)
* src/current/compiler/js.xsl (compile)[lv:match]: Display error on bad
  match, as it was intended.
2018-01-29 13:14:02 -05:00
Mike Gerwitz 00ce03ab25 src/current/calc.xsd (nameType): Permit numeric literals (bugfix)
* src/current/calc.xsd (nameType): Permit numeric literals.

These have already been permitted, but the XSD disallowed.
They worked in templates.
2018-01-29 13:13:56 -05:00
Mike Gerwitz 854f87a60d template: Remove accidental debug output
* src/current/include/preproc/template.xsl (preproc:apply-template)[@*]:
  Remove debug output.
2018-01-25 15:39:20 -05:00
Mike Gerwitz d128b2384e entry-form: Ignore missing DOM elements
* src/current/scripts/entry-form.js (updateParamTestcaseDfn): Ignore if DOM
  element cannot be found.
2018-01-25 15:27:27 -05:00
Mike Gerwitz 78ea30e7b5 Retain unknown template param references during expansion
For example, with template-generating templates, if a reference is unknown
and therefore determined to be blank, an attribute might be completely
removed while the template is being generated.  (See the /when package in
core for an example.)  That is not good.

* src/current/include/preproc/template
  (preproc:expand-template): Add `tpl' tunneling param to
    preproc:apply-template application.
  (preproc:apply-template)[@*]: Retain param reference if applying template
    does not define it.
2018-01-25 14:53:31 -05:00
Mike Gerwitz 87a059f0c8 Retain template conditionals verbatim if param unknown
This is important for template-generating templates.

* src/current/include/preproc/template.xsl (lv:if,lv:unlesS):
  Retain conditional nodes verbatim when referenced param is unknown.
2018-01-18 15:44:12 -05:00
Mike Gerwitz 211387ce2f Mark generated @yields on classes and rate-each as such on symbols
* src/current/include/preproc/expand.xsl
  (lv:classify): Set `@preproc:yields-generated' if `@yields' was not
    previously defined.
* src/current/include/preproc/macros.xsl:
  (lv:rate-each): Set `@preproc:yields-generated` if `@yields' was not
    previously defined.
* src/current/include/preproc/symtable.xsl:
  (lv:rate, lv:classify): Set `@preproc:generated` on symbol if
    `@preproc:yields-generated'.
2018-01-16 12:12:33 -05:00
Mike Gerwitz f8d21c1c5f summary: Correct height of pipes denoting length
* src/current/include/calc-display.xsl
  (c:sum[@of], c:length-of): Add `\left', `\right'.
* src/current/summary.xsl: Update "N.B." section.
2018-01-11 08:42:04 -05:00
Mike Gerwitz 2767917d62 summary: Do not terminate on unknown match-desc calculations
Not time to address styling this at the moment.  This code was previously
not reached until recent fixes.  And I forgot that this was even
permitted (such complex calculations within matches)!

* src/current/summary.xsl (match-desc): Do not terminate on unknown
  match-desc elements.
2018-01-09 15:55:39 -05:00
Mike Gerwitz 7ff3a2d702 summary: Correct unknown match calc error display
* src/current/summary.xsl (match-desc): {c=>lv}:classify.
2018-01-09 15:44:16 -05:00
Mike Gerwitz aa99cebc65 Yield 0 and provide warning for empty rate blocks
Rather than producing a syntax error, provide a useful warning and simply
yield 0.

* src/current/compiler/js.xsl (compile)[lv:rate]: Warn and yield 0 when no
    calculation is provided in the body.
2018-01-04 14:51:20 -05:00
Mike Gerwitz 107581017b Support constant refs with lv:match/@on
We've never done this before (thus this bug lasting so many years), but only
because it doesn't really make much sense in practice; this was caught when
writing test cases.

* src/current/compiler/js.xsl (compile)[lv:match]: Compile `consts' instead
    of `args' when referencing a constant.
2018-01-04 14:38:18 -05:00
Mike Gerwitz a62d155eb0 Resolve lv:param-add/@value before processing
* src/current/include/preproc/template.xsl
  (preproc:gen-param-value)[lv:param-add]: Resolve value of @value before
    processing numeric expression (to support template variables).  Error
    when any values are not numeric rather than producing NaN.
2018-01-04 11:05:58 -05:00
Mike Gerwitz d8c7d8fee2 Ignore constant parsing for template param references
This is imperfect, but will work based on current assumptions.

* src/current/include/preproc/expand.xsl (preproc:expand)[c:const,lv:const):
  If '@' is found, do not perform expansion.
2018-01-04 11:04:55 -05:00
Mike Gerwitz cd5a1a99fc summary: Display @desc in breakdown if @label is not available
* src/current/summary.xsl (ultra-breakdown-set): Use @desc if no @label.
2017-12-22 11:13:42 -05:00
Mike Gerwitz 4ed63b3661 summary: Remove index underscores from TeX
They corrupt the display.  This solution isn't ideal, though.

* src/current/include/calc-display.xsl: Use new `preproc:tex-index'.
  (preproc:tex-index): Add function.
* src/current/summary.xsl: Use `preproc:tex-index' for @index display.
2017-12-22 11:07:24 -05:00
Mike Gerwitz 55bd91d05e summary: Simplify display of generators in let list
* src/current/include/display.xsl (preproc:dim-to-str): New function.
  (summary:desc): Use it.  Display appropriate generator dimensions as a
  string rather than hard-coding to `vector'.  Remove yield symbol ref.
2017-12-21 13:39:05 -05:00
Mike Gerwitz 61279a36dc summary: Remove parenthesis from let list symbol refs
* src/current/include/display.xsl: Remove parenthesis around let list
  symbols.
* src/current/summary.xsl: Remove parenthesis around generator symbol.
2017-12-21 13:32:09 -05:00
Mike Gerwitz aba2e7a5b2 summary: Add const description in let list
* src/current/include/display.xsl (summary:desc): Include const @desc in let
  list.
2017-12-21 13:28:17 -05:00
Mike Gerwitz 97977332d5 summary: Correct length notation
Vector length is customarily denoted by |V|.

* src/current/include/calc-display.xsl (c:sum, c:length-of): Use new
  notation.
* src/current/summary.xsl: Update N.B. with new notation.
2017-12-21 13:18:41 -05:00
Mike Gerwitz 93b3a14cfb summary: Remove link from generator name
There's no point in having a link to itself.  Further, the link was wrong.

* src/current/summary.xsl (gen-equation-details): Remove link from generator
  name.
2017-12-21 11:03:22 -05:00
Mike Gerwitz 39e83a80d0 preproc: Add `param-sym-value' for templates
* src/current/include/preproc/template.xsl
  (preproc:gen-param-value)[lv:param-sym-value]: New template.
* src/current/rater.xsd (templateParamGenGroup): Add `param-sym-value'.
2017-12-21 10:42:20 -05:00
Mike Gerwitz 0f88b902a9 summary: Correct rendering of externs 2017-12-20 16:49:34 -05:00
Mike Gerwitz c59ed64d4e macros: Ignore preproc:tpl-barrier during class conversion
* src/current/include/preproc/macros.xsl
  (preproc:macros): Only consider lv:* in counts.  Ignore preproc:*.
2017-12-19 16:51:18 -05:00
Mike Gerwitz c99e4d00f6 symtable: Override local status of imported symbols
When a symbol is imported as local, and subsequently directly imported using
another package with @export, the symbol needs to be overridden as
non-local.

* src/current/include/preproc/symtable.xsl
  (preproc:sym-discover): Deduplicate based on local status.
  (preproc:symtable-process-symbols): Retain non-local symbols when only
    local version of the symbol exists.
2017-12-19 16:48:44 -05:00
Mike Gerwitz 60c01b22ba summary: Handle duplicate l:dep symbols during lookup
This is a linker bug that I don't have time to debug at the
moment.  Hopefully the linker will be re-written in Scheme sometime in the
near future anyway.

* src/current/summary.xsl (preproc:sym-lookup): Take first result of symbol
  lookup.
2017-12-19 14:25:45 -05:00
Mike Gerwitz 62c4ce402c preproc: Copy rate-each/@dim only if it exists
If it is copied an yields an empty value, then it is later converted into a
0, which is wholly incorrect in the case of generators.

* src/current/include/preproc/macros.xsl (preproc:macros)[lv:rate-each]:
  Conditionally copy `@dim'.
2017-12-19 14:21:08 -05:00
Mike Gerwitz 872da96f9e summary: Allow empty symbol lookups
This is just a temporary workaround for a failed lookup; no time to debug at
the moment.

* src/current/summary.xsl (preproc:sym-lookup): Allow empty sequence as
  return value.
2017-12-19 11:00:52 -05:00
Mike Gerwitz 87ab3ff468 summary: Wrap .entry-value
* src/current/summary.css: (.entry-value): Wrap whitespace.
2017-12-19 11:00:13 -05:00
Mike Gerwitz d6d3283923 summary: Re-add N.B. section from old summary page
With corrections.

* src/current/summary.xsl (gen-pkg-menu): New menu item.
  (summary-info): Correct text.
2017-12-15 09:54:18 -05:00
Mike Gerwitz 03ffadb703 summary: Ignore invalid JSON data when loading page
If the hash is e.g. `:class:*', it tries to parse it, which is
invalid.  There's a better solution to this problem, but I don't have time
to test possibly messing this up right now.

* src/current/scripts/entry-form.js (begin): Ignore JSON parsing errors.
2017-12-15 09:38:21 -05:00
Mike Gerwitz 337153aaa7 summary: Correct rendering of externs in matches
This same problem can occur anywhere---everything needs to be converted to
use the new `preproc:sym-lookup', but I don't have the time at the moment.

* src/current/summary.xsl (preproc:sym-lookup): New function.
  (program): New toplevel variable.
  (process-match)[lv:match]: Use function.
2017-12-15 09:34:11 -05:00
Mike Gerwitz dd42267bc9 summary: Render package descriptions on entry form 2017-12-14 12:13:21 -05:00
Mike Gerwitz eff8a01a42 summary: Correct math rendering on initial page load
Race condition.
2017-12-14 12:13:21 -05:00
Mike Gerwitz 5bdcffc221 summary: Filter internal values from menu
This really reduces noise, especially with all of the package eligibility
classifications.
2017-12-14 12:13:21 -05:00
Mike Gerwitz 43190ef6af summary: Add symbol refs to breakdown
This should be extremely helpful in understanding the breakdown.  And
convenient.
2017-12-14 12:13:21 -05:00
Mike Gerwitz c98ece9d68 summary: Group params on entry form by package
* src/current/include/entry-form.xsl: Group entry form params.
2017-12-14 12:13:21 -05:00
Mike Gerwitz dc5e5b74dc summary: Correct rendering of classifications using equations
* src/current/include/calc-display.xsl (calc-iversons)[recurse]: Add
    parameter.  Conditionally recurse.
* src/current/summary.xsl (match-desc): Properly process c:* children.
2017-12-14 12:13:21 -05:00
Mike Gerwitz 2ccf78544a summary: Angry fruit salad
This adds a great deal of colorful styling to make the Summary Page a bit
easier to understand at a glance.
2017-12-14 12:13:18 -05:00
Mike Gerwitz 22b4d37317 preproc: Optimize away c:{sum,product} containing preprocessed lv:*
This optimization (which already existed) is supposed to remove
c:sum/c:product nodes if they contain one or fewer calculations, but it
failed to remove them when inline templates were used (because it creates,
well, a template inline).

Instead, we'll assume that any lv:* nodes handled by the preprocessor will
be okay.  In the case of inline templates, they receive a preproc attribute
identifying what created it.

I hope this is a valid assumption.  This will be thoroughly tested.  If only
we had test cases for the preprocessor.

* src/current/include/preproc/expand.xsl: (preproc:expand)[c:sum,c:product]:
    Consider optimization for `lv:*[@preproc:*]'.
2017-12-13 13:50:24 -05:00
Mike Gerwitz 0f0e88d9fb summary: Correct casting for scalars
* src/current/scripts/entry-form.js: Ensure scalars are cast to numbers
    before outputting dfn.
2017-12-11 16:09:10 -05:00
Mike Gerwitz 5e5458dd3b summary: Add param text case dfn below input
The idea is to provide some guidance with how YAML test cases are supposed
to appear.

This just adds to the massive cluster that is the `entry-form.js'.

* src/current/include/entry-form.xsl (entry-form)[preproc:sym]: Add
    `entry-testcase-dfn' div.
* src/current/scripts/entry-form.js: Invoke `updateParamTestcaseDfn' in
    various event listeners.
  (populateBucket): Invoke `updateParamTestcaseDfn'.
  (updateParamTestcaseDfn, getParamTestcaseDfnElement): New functions.
* src/current/summary.css: Style `.entry-testcase-dfn'.
2017-12-11 15:25:31 -05:00
Mike Gerwitz f79deb725e summary: Add "percent*" to VOIs
* src/current/scripts/entry-form.js (updateVois): Add "percent"-prefixed
    values to VOI list.
2017-12-11 14:03:03 -05:00
Mike Gerwitz eb01129e24 summary: Filter internal classes from class overview
* src/current/scripts/entry-form.js (updateSummaryClasses): Hide
    "-"-prefixed classes from Classification Overview.
2017-12-11 14:03:03 -05:00
Mike Gerwitz d612c593b2 summary: Add param names and links aside desc in entry form
This existed in the old summary pages.  Since we'll be having certain people
reference ids, they need to be easily visible from somewhere.

* src/current/include/entry-form.xsl (preproc:sym)[entry-form]: Add param
    name and link.
* src/current/summary.css: Style it.
2017-12-11 14:03:02 -05:00
Mike Gerwitz 3970659a81 summary.css: Fix header width in FF
Long-standing bug.  Didn't often see it because FF performance was
relatively poor for the Summary Pages compared to Chromium until recently,
so I didn't often load the page in it (despite it being my primary browser).

* src/current/summary.css (legend): width:auto.
2017-12-11 11:38:23 -05:00
Mike Gerwitz 838ddb6e32 summary: Correct rendering of nested c:let expressions
If nested c:let expressions contained values of the same name, they would
all be rendered, rather than just the one intended.

* src/current/include/display.xsl (do-gen-let-list): Pass let symbol to
    `_gen-let-list-item'.
  (_gen-let-list-item): Render only values part of context let expression.
    [letsym]: New parameter.
2017-12-11 10:50:51 -05:00
Mike Gerwitz e78c3cbe98 symtable: Add @lparent to let lparam symbols
* src/current/include/preproc/symtable.xsl (preproc:symtable)[c:let]:
    Add @lparam to symbol.
2017-12-11 10:50:49 -05:00
Mike Gerwitz a38327b505 expand: Continue macro expansion after @dim conversion
This was recently introduced and was noticed because c:let/@name was not
being generated under certain circumstances.

* src/current/include/preproc/expand.xsl (preproc:expand): Continue applying
    templates after @dim expansion (rather than copying child nodes).
2017-12-11 10:42:52 -05:00
Mike Gerwitz f38e6c896b Add template barriers for metadata
This (hopefully) prevents metadata from leaking outside of template
expansions where they are not wanted.

* src/current/include/preproc/macros.xsl (preproc:macropass): Strip
    cruft (new barrier nodes) on final pass.
* src/current/include/preproc/template.xsl (preproc:expand-template):
    Enclose template expansion in preproc:tpl-barrier (which is stripped on
    the final pass).
  (preproc:apply-template)[lv:param-meta]: Document template.  "Hoist"
    node (set attribute) if not contained within lv:param-copy.
  (preproc:gen-param-value)[lv:param-inherit]: Consider hoisted nodes behind
    barrier.
2017-12-08 14:48:59 -05:00
Mike Gerwitz 75aa0fab7e Summary Page: Render template expansion points
This renders template expansions as part of the calculation breakdown, which
goes a long way to understanding what the system is doing.

This further updates the hover over the breakdown to color-code based on
depth, making it easier to observe the nesting of
expressions.  Sub-expressions that are toplevel results of template
expansions (nodes marked with templates) have a thicker border.

* src/current/summary.css: Add template id styling, breakdown colors, and
    misc. styling.
* src/current/summary.xsl (ultra-breakdown-set): Enclose label in
    span.  Output template id, if applicable.  Mark fieldset if templated.
2017-12-08 14:48:57 -05:00
Mike Gerwitz 2f8ce0f234 Mark toplevel nodes affected by template expansion
This allows for debugging expansions, which are otherwise confusing and
difficult.  This will be valuable information for the Summary Pages as
well (see future commit).

* src/current/include/preproc/template.xsl (preproc:expand-template): Mark
    toplevel nodes after expansion.
  (preproc:mark-tpl-expansion): Add templates.
2017-12-08 13:53:12 -05:00
Mike Gerwitz 65890f7156 Clean up unused JS compiler code
Cruft left around from the symbol table refactoring long ago.

* src/current/compiler/js.xsl
  (compile)[preproc:rate]: Remove template.
    [preproc:class]: Remove template.
  (compile-rates)[lv:package]: Remove template.
2017-12-08 13:51:43 -05:00
Mike Gerwitz c5e67861c9 depgen: Do not perform dependency generation within templates
This makes me slightly uncomfortable because I haven't researched why
exactly this was not a problem before.  We encountered this issue using an
inline template iterating over the symbol table yielding a `c:value-of',
which is admittedly something that we haven't done before.

Hopefully it's an isolated case.

I diffed the offending object file and the entire linked tax calculator and
they were bit-for-bit identical, so we're probably good.

* src/current/include/depgen.xsl (preproc:depgen): Do not perform dependency
    generation within templates.
2017-12-06 14:39:54 -05:00
Mike Gerwitz 2878d1099c Defer inline-templates with sym-set until symtable is available
Other code relied on expand-sequence, but this really should be implicit,
since it is deceptively useless otherwise.

* src/current/include/preproc/template.xsl (preproc:macros): Defer
    processing of inline-template with sym-set until symbol table is
    available.
2017-12-05 15:07:29 -05:00
Mike Gerwitz c207fad008 Allow ##other nodes in apply nodes
The primary motivation for this is to allow for template conditionals.

* src/current/calc.xsd (applyArgs): New group.
  (apply,recurse): Use it in sequence.
2017-12-04 13:40:12 -05:00
Mike Gerwitz 0fb1bae487 Add c:sum/@dim
This allows the result of a rate block to be a matrix; there was previously
no way for a named value to be assigned a matrix unless it was a parameter.

This is a bit of a kluge---the compiler won't discover the proper type
information and won't perform the proper safeguards.

* src/current/calc.xsd (sum)[@dim]: Add attribute.
* src/current/compiler/js-calc.xsl: Add xs namespace.
  (compile-calc): Do not perform casting when @dim > 1.
* src/current/include/preproc/expand.xsl
  (lv:rate-each): Include @dim in c:sum expansion.
* src/current/include/preproc/macros.xsl:
  (c:*/@generates): Use @dim to determine symbol dimensions.
* src/current/include/preproc/expand.xsl: Parse @dim aliases (e.g. "vector",
  "matrix").
2017-12-04 13:39:55 -05:00
Mike Gerwitz ef1e6735b6 entry-form: Correct rendering of params using imported typedefs
If a param referenced a typedef that was imported from another package, the
summary page displayed an error rather than rendering the field.  This is a
problem for testing using summary pages!

Long-standing bug with a fairly easy fix.

* src/current/include/entry-form.xsl:
  (entry-form-field lv:param): Consider correct symbol (was using param
    symbol, not typedef).
  [typesrc]: Modernize syntax.
  [typedef]: Allow for non-root-child elements.  The old version of TAME
    required toplevel typedefs; that's no longer the case.
2017-11-29 13:22:29 -05:00
Mike Gerwitz e52d6c1eb0 depgen: Add error for rate block name conflicts
This can occur during template expansion if the user is not careful in
ensuring that all generated blocks will have unique names.  The error was
not useful: it failed type validation, which results in an internal error in
the compiler (from the user's perspective) and outputs no useful information
to aid in debugging.

* src/current/include/depgen.xsl
  (preproc:depgen preproc:sym): User-friendly error if more than one rate
    element.
  [rate]: Allow multiple rate elements.
2017-11-29 13:19:41 -05:00
Mike Gerwitz df4d976277 csvm2csv: Add support for date->ts conversion
* src/current/tools/csvm2csv: Modify example to include date.
  (rangeout, parseLine): Renamed from `rangeout'.  Add date->timestamp
    parsing.
2017-11-22 13:05:02 -05:00
Mike Gerwitz 481346b237 Include package eligibility classes during linking
This is important to include all terminating classifications, which
include assertions.  This is essential now that @keep support has been
removed; this essentially does the same thing, but in a more
sane/strict manner.

* src/current/compiler/linker.xsl (l:depgen)[preproc:symtable]:
  Include package-level eligibility class in initial dependency list.
2017-08-07 13:07:06 -04:00
Mike Gerwitz 90c9893a9e Remove include of now-missing defnote-attr
This was removed recently.

* src/current/dot/defnode-attr.xsl: Remove include.
2017-07-21 15:26:05 -04:00
Mike Gerwitz fe7849224d js-calc.xsl: Remove now-unneeded worksheet ns declaration
* src/current/compiler/js-calc.xsl: Remove `w' ns prefix from root node.
  Style root node.
2017-07-18 10:27:42 -04:00
Mike Gerwitz d1dbea91ac Remove debug collection from compiled function calls
This will hopefully provide a performance boost, and is a cheap
optimization to make.  The information it collected was pretty useless
in practice.

* src/current/compiler/js-calc.xsl (compile) [c:*]:
  Do not encase calculations with function ancestors in debug
  collection functions.
2017-07-18 10:14:22 -04:00
Mike Gerwitz 666b9d6a97 Remove broken calc debug worksheet predicates 2017-07-18 10:06:34 -04:00
Mike Gerwitz 52809c5148 src/current/compiler/js-calc.xsl: Strip xsl ns prefix
* src/current/compiler/js-calc.xsl: Strip xsl namespace prefix.
  Update copyright year.
  Set XSLT version to 2.0.
2017-07-18 10:04:27 -04:00
Mike Gerwitz aeded560f4 Include meta automatically in link list
These used to be automatically added via @keep.

* src/current/compiler/linker.xsl (l:depgen): Include meta symbols.
* src/symtable/symbols.xsl (lv:meta): @pollute instead of @keep.
2017-07-13 15:24:30 -04:00
Mike Gerwitz 32afebd631 Preprocess input map nodes
In particular, I want it to handle absolute import paths.  It does
this for the return map; I forgot to add it here.

* src/current/compiler/map.xsl (lvmc:compile) [lvm:program-map]:
  Preprocess nodes.
2017-07-13 09:42:20 -04:00
Mike Gerwitz dbb368ab34 macros.xsl: Remove unnused param boolean class generation
A classification used to be generated for each param for convenience;
this has been deprecated by the progui package generation (when `q:'
is used).

* src/current/include/preproc/macros.xsl: Remove template.
2017-07-12 15:58:39 -04:00
Mike Gerwitz 2af0daceb3 Remove @keep support from linker
And everything else.

This is a big (important) change; it addresses one of the greatest
pains of the system.

Keeps were added during the DSL rewrite (to support symbols and such)
to work around the issue that there was no symbol-driven map; it
allowed symbols to persist disjoint from the `__yield' dependency
graph so that they could be mapped back and used by external systems.

The problem with that is that it's both messy (coupling the concept of
external dependencies with the actual code) and difficult to work
with.  It had a huge performance impact on the linker for two reasons:

  - Checking whether a package had already been seen and importing the
    keeps on first visit was expensive because of tree searching and
    manipulation; and
  - _every_ keep was imported and processed by the linker, even if it
    wouldn't end up being used by a particular program.

The later especially had huge performance impacts on the entire
system.

The entire dependency graph is now map-driven, with the exception of
the implicit `__yield' (which will eventually be moved into the map as
well and the magic `lv:yield' removed in favor of a template).

Performance-wise: our largest program ("dwelling") has many thousands
of symbols and the largest package imported the majority of them, many
of them unneeded, as the result of @keep subgraphs.  Compilation of
the largest package within that (for the UI) took about a minute and a
half and ate up ~6GiB of RAM, for what really is a trivial task of
resolving externs, some basic symbol processing, a topological sort,
and ordering code fragments.

After this change, it takes ~15s and less than 2GiB of RAM.  Still a
lot---and more improvements can be made---but much, much better.

@keep and friends was left in rater.xsd so that nothing breaks while
code is cleaned up; it'll be removed in the future.

* src/current/compiler/linker.xsl: Remove @keep support.
* src/current/dot/attr-keep.xsl: Remove now-unneeded template.
* src/current/dot/defnode.xsl: Remove @keep and related.
* src/current/include/preproc/eligclass.xsl: Remove @keep and related.
* src/current/include/preproc/expand.xsl: Remove @keep and related.
* src/current/include/preproc/macros.xsl: Remove @keep and related.
* src/current/include/preproc/symtable.xsl: Remove @keep and related.
* src/current/rater.xsd: Add TODO to remove @keep and friends.
2017-07-12 15:58:37 -04:00
Mike Gerwitz 52c1bb5ebe Properly resolve paths of symbols of imports
This solves a long-standing problem whereby relative paths are not
properly resolved, leading to incorrect symbol conflicts when relative
paths to the same package vary between two imports.

See doc/notes/path-processing for an illustration.

* src/current/include/preproc/path.xsl
  (preproc:resolve-relative-import): Add function.
  (preproc:resolv-path, preproc:resolve-path, preproc:get-path): Add
  functions to invoke existing templates.
* src/current/include/preproc/symtable.xsl (preproc:symimport): Use
  `preproc:resolve-relative-import'.
* doc/notes/path-processing: Add notes.
2017-07-12 14:32:33 -04:00
Mike Gerwitz 7472cb882c Return map symbol support
This is a backwards-incompatible change that, like the input map,
requires the use of symbols in the return map.  This will allow us to
forego the use of @keep and will have the return map be the authority
of what gets linked (all of its dependencies).

* src/current/compiler/map.xsl: Add symbol support to return-map.
2017-07-12 14:23:26 -04:00
Mike Gerwitz 5b9cfaec31 Allow ##any in return map
* src/current/map.xsd (return-map): Allow ##any.
2017-07-12 14:16:42 -04:00
Mike Gerwitz 7d9fb48e11 Strip `xsl' namespace prefix from path.xsl
This also sets the XSLT version to 2.0.

* src/current/include/preproc/path.xsl: Strip `xsl' namespace prefix.
2017-07-12 10:10:45 -04:00
Mike Gerwitz c156c10989 Provide symtable to all map compilation steps
* src/current/compiler/map.xsl: Pass symtable to all templates.
2017-07-11 08:59:17 -04:00
Mike Gerwitz 86ac6546dc linker.xsl: Strip xsl ns prefix
* src/current/compiler/linker.xsl: Strip xsl ns prefix.
2017-07-11 08:59:16 -04:00
Mike Gerwitz e237ab47f2 Recognize meta fields in map
* src/current/compiler/map.xsl (lvmc:validate-ui) [lvm:program-map]:
  Recognize "meta:"-prefixed meta field ids in map.
2017-07-07 15:18:20 -04:00
Mike Gerwitz 68dd0706a8 Simplify unknown source field map detection
Simple refactoring.  Code still is terrible.

* src/current/compiler/map.xsl (lvmc:validate-ui) [lvm:program-map]:
  Factor common expressions.
2017-07-07 15:18:20 -04:00
Mike Gerwitz 652465a0a0 tools/strip: Add utility 2017-07-05 13:52:06 -04:00
Mike Gerwitz b7596515b3 map compiler: Use symbol table
This allows for the proper importing of symbols into the package
generated by the map compiler, which in turn allows for processing
their default values.
2017-07-05 13:52:04 -04:00
Mike Gerwitz 8e5666f845 Ignore externs in local polluting symbol processing
* src/current/include/preproc/symtable.xsl (preproc:symimport lv:import):
  Ignore symbols flagged as externs when processing local polluted symbols.
2017-07-05 13:52:02 -04:00
Mike Gerwitz 83e3d72b6e Include param default in symbol
* src/symtable/symbols.xsl (preproc:symtable lv:param):
  Add `@default' attribute to represent param default value.
2017-07-05 13:51:59 -04:00
Mike Gerwitz 353440ef31 Reorder static linked output
`set_defaults' wasn't in scope of maps.

* src/current/compiler/js.xsl (compiler:exit-rater lv:package):
  Remove static output.
* src/current/compiler/linker.xsl (l:link-deps lv:package):
  Link static after all other blocks, at highest scope within the
  compiled module.
2017-07-05 13:51:28 -04:00
Mike Gerwitz ec4c73f749 Correct syntax error in linked output for known class map
* src/current/compiler/js.xsl (lv:paclage compiler:exit-rater):
  Add missing semicolon
2017-07-05 13:51:28 -04:00
Mike Gerwitz f2821af5cb src/current/map.xsl: Permit from/@scalar 2017-07-05 13:51:28 -04:00
Mike Gerwitz 629aa9d342 c1map.xsd: Add schema
This just ignores everything for now.
2017-07-05 13:51:28 -04:00
Mike Gerwitz 12f3fa5b6e Add missing rater.xsd
This is of limited use now with template support.  But it is useful
documentation nonetheless.
2017-04-06 23:33:53 -04:00
Mike Gerwitz 1d3aaf3339 Extracted param symbol generation
The `preproc:param-dim' template must remain for now, as it is used by
others.

* src/current/include/preproc/symtable.xsl
  (preproc:symtable)[lv:param]: Extracted template.

* src/symtable/symbols.xsl
  (preproc:symtable)[lv:param]: Added template.

* test/symtable/symbols.xsl
  (lv:param): Scenario added.
2016-11-17 23:55:23 -05:00
Mike Gerwitz f396858fb1 Extracted meta symbol generation
* src/current/include/preproc/symtable.xsl
  (preproc:symtable)[lv:meta]: Extracted template.

* src/symtable/symbols.xsl
  (preproc:symtable)[lv:meta]: Added template.

* test/symtable/symbols.xsl
  (lv:meta): Scenario added
2016-11-17 23:55:23 -05:00
Mike Gerwitz c199f4739e Extract template symbol generation
* src/current/include/preproc/symtable.xsl
  (preproc:symtable)[lv:template]: Extracted template.

* src/symtable/symbols.xsl:
  (preproc:symtable)[lv:template]: Added template.

test/symtable/symbols.xsl: Added test case.
2016-11-17 23:55:23 -05:00
Mike Gerwitz 76f41e6250 Symbol format and type documentation
It's important that others understand the system before I keep adding to
the mystery.  This is at least a good start.

It also obviates certain awkward design issues that have evolved over
time and need addressing.  Note that it also mentions that `keep' is
marked for removal---this is the situation that prompted this
documentation; changes will be made to work toward its removal to
improve the terrible linker performance when given many thousands of
symbols defined in over 500 separate packages.

* src/symtable.xsl: Add menu for symbols.
* src/symtable/symbols.xsl: Added.
2016-11-17 23:55:23 -05:00
Mike Gerwitz 0c2ef00e51 lv:classify/@desc whitespace normalization during macropass
This allows for nice formatting with newlines (to avoid excessively long
lines) without affecting the output.

* src/current/include/preproc/expand.xsl
  (preproc:expand lv:classify/@desc): Normalize lv:classify/@desc whitespace
2016-10-25 11:40:08 -04:00
Mike Gerwitz 5a9fb0d142 lv:classify/@set stripped from macropass
This is no longer used.

* src/current/include/preproc/expand.xsl (lv:classify):
  Remove `@set' processing.
2016-10-25 11:37:46 -04:00
Mike Gerwitz ea3ae797b3 Version bump {0.0.1=>1.0.0} 2016-08-24 12:38:03 -04:00
Mike Gerwitz c0d95b4a05 Add copyright headers to src/current/ 2016-08-24 12:38:03 -04:00
Mike Gerwitz ff01f39c1e Liberate current implementation of "Calc DSL"
(Copyright headers will be added in the next commit; these are the
original files, unaltered in any way.)

The internal project name at LoVullo is simply "Calc DSL".  This
liberates the entire thing.  If anything was missed, I'll be added
later.

To continue building at LoVullo with this move, symlinks are used for
the transition; this is the exact code that is used in production.

There is a lot here---over 25,000 lines.  Much of it is in disarray from
the environment surrounding its development, but it does work well for
what it was intended to do.

(LoVullo folks: fork point is 65723a0 in calcdsl.git.)
2016-08-24 12:38:00 -04:00
Mike Gerwitz ebb88b9345 conf.xsl.in -> src/init.xsl.in
The thrush reference was also removed, as TAME does not currently make
use of it.

* .gitignore: Update path accordingly.
* configure.ac: Update path accordingly.
* src/init.xsl.in: Moved from conf.xsl.in.
2016-08-23 11:26:47 -04:00
Mike Gerwitz ea3edc18ca Initial symbol documentation, find-symbol
* doc/tame.texi: Include `Symbol Table'.

* src/symtable.xsl: Added.
* test/symtable.xspec: Added, testing `find-symbol'.
2016-08-23 11:04:50 -04:00
Mike Gerwitz 23af07fd08 @{=>tt}ref for graph function refs
* src/graph:xsl: All function @ref's replaced with @ttref
2016-07-14 09:16:17 -04:00
Mike Gerwitz 1457d72221 Update literate-xsl
This makes changes necessary to new ref format (which includes arity).

* src/graph.xsl: @ref function arity added
* src/preproc/expand/expand-sequence.xsl: @ref function arity added
* tools/literate-xsl: Submodule updated
2016-07-14 09:15:38 -04:00
Mike Gerwitz da9a16ae85 Add graph:lookup-from-doc
* src/graph.xsl (graph:lookup-from-doc): Added
* test/graph-doc.xml: Added
* test/graph-test.xsl: Associated test data
* test/graph.xspec: Associated tests added
2016-07-13 11:31:19 -04:00
Mike Gerwitz 000c0345bd Add graph:make-from-deps convenience function
* src/graph.xsl (graph:make-from-deps): Added with documentation.
* test/graph{-test.xsl,.xspec}: Updated accordingly.
2016-07-06 00:16:33 -04:00
Mike Gerwitz b2d87c5318 Re-order graph:dep-lookup arguments to favor partial application
* src/graph.xsl (graph:dep-lookup): Re-order arguments
* test/graph.xspec: Updated accordingly
2016-07-06 00:16:12 -04:00
Mike Gerwitz e5da6f8ce1 Add graph:make-from-vertices
* src/graph.xsl (graph:make-from-vertices): Added
* test/graph-test.xsl (foo:graph-with-dupes): Added duplicate edges
* test/graph.xspec: Added tests
2016-07-06 00:16:12 -04:00
Mike Gerwitz 641147cd8f graph:union normalize/dedupe test
This was already happening, but formally test and document it, since
it's a very useful property.

* src/graph.xsl (graph:union): Document dedupe behavior
* test/graph-test.xsl: Add test data
* test/graph.xspec: Add dedupe test for graph:union
2016-07-06 00:16:12 -04:00
Mike Gerwitz bcf1e0457f Move graph:dep-lookup into Package Subgraphs subsection
* src/graph.xsl (graph:dep-lookup): Moved into subsection with
  introductory paragraph.
2016-07-06 00:16:11 -04:00
Mike Gerwitz 551e489c5f Add graph:union
* src/graph.xsl (graph:union): Added
* test/graph-test.xsl: Test data added
* test/graph.xspec: Tests added
2016-07-06 00:14:53 -04:00
Mike Gerwitz e34cf22d6b Add graph:reverse
* src/graph.xsl: Added graph:reverse
* test/graph.xspec: Associated tests
* test/graph-test.xsl: Added test data
2016-07-06 00:14:50 -04:00
Mike Gerwitz 6bb4c05830 Add (beginning of) graph API
* doc/tame.texi: Add graph include.
* src/graph.xsl: Added.
* test/graph-test.xsl: Added.
* test/graph.xspec: Added.
2016-07-05 23:49:30 -04:00