Commit Graph

17 Commits

Author SHA1 Message Date
Nick Fitzgerald
e1f4e29efe ISLE: Add a nodebug type attribute to disable derive(Debug)
I need this to move the x64 `Inst` definition into ISLE without losing its
custom `Debug` implementation that prints the assembly for the `Inst`.
2022-02-03 14:08:08 -08:00
Nick Fitzgerald
7f8cb75e54 Allow terms to have both extractors and constructors
Fixes #4
2021-11-11 15:56:55 -08:00
Nick Fitzgerald
bffaccde1f Add a tutorial to the README 2021-11-11 15:56:55 -08:00
Nick Fitzgerald
922a3886d5 Fix let variable typing rules 2021-11-11 15:56:55 -08:00
Chris Fallin
20bc5ca7a8 Support extern constants of any primitive type. 2021-11-11 15:56:55 -08:00
Chris Fallin
7d38b3b6d8 Revamped error handling: keep going beyond some errors to accumulate a list of build errors, like most conventional compilers. 2021-11-11 15:56:55 -08:00
Chris Fallin
3f96068f94 Some test cases for arg-less enums. 2021-11-11 15:56:55 -08:00
Chris Fallin
edc95c51a0 Support for bools. Also fix fallible/infallible mixup for ctors. 2021-11-11 15:56:55 -08:00
Chris Fallin
a412cce615 Infallible extractors, and some fixes to fallibility in return types (Option<T> vs T). 2021-11-11 15:56:55 -08:00
Chris Fallin
6daa55af82 Initial draft of DSL semantics complete.
This latest refactor adds "extractor macros" in place of the
very-confusing-even-to-the-DSL-author reverse-rules-as-extractors
concept. It was beautifully symmetric but also just too mind-bending to
be practical.

It also adds argument polarity to external extractors. This is inspired
by Prolog's similar notion (see e.g. the "+x" vs. "-x" argument notation
in library documentation) where the unification-based semantics allow
for bidirectional flow through arguments. We don't want polymorphism
or dynamism w.r.t. directions/polarities here; the polarities are
static; but it is useful to be able to feed values *into* an extractor
(aside from the one value being extracted). Semantically this still
correlates to a term-rewriting/value-equivalence world since we can
still translate all of this to a list of equality constraints.

To make that work, this change also adds expressions into patterns,
specifically only for extractor "input" args. This required quite a bit
of internal refactoring but is only a small addition to the language
semantics.

I plan to build out the little instruction-selector sketch further but
the one that is here (in `test3.isle`) is starting to get interesting
already with the current DSL semantics.
2021-11-11 15:56:55 -08:00
Chris Fallin
1ceef04680 (and ...) combinator in patterns 2021-11-11 15:56:55 -08:00
Chris Fallin
602b8308ce More work on sketch for isel and some TODO items derived from it. 2021-11-11 15:56:55 -08:00
Chris Fallin
d725ac13b2 Codegen: parameterize on a generated Context trait that contains external ctors/etors. 2021-11-11 15:56:55 -08:00
Chris Fallin
3ccbaf0f69 Generate match {} statements by merging adjacent MatchVariant trie edges. 2021-11-11 15:56:55 -08:00
Chris Fallin
ed4c857082 Priority-trie: merge edges with different priorities into ranges when possible. 2021-11-11 15:56:55 -08:00
Chris Fallin
b8e916a0ab Another example, testing rule priorities a bit 2021-11-11 15:56:55 -08:00
Chris Fallin
4a2cd78827 Working example and README 2021-11-11 15:56:55 -08:00