nxt.symbolic

Symbolic (Regular) Expressions and Predicate Logic.

Syntax is similar to Emacs' sregex, rx.

String patterns are matched by their raw bytes for now.

Members

Classes

Acronym
class Acronym

Word/Symbol Acronym Pattern.

Alt
class Alt

Alternative of Patterns in ALTS.

Any
class Any

Any Byte.

Clause
class Clause

Pattern Paired with Prefix and Suffix.

Lit
class Lit

Literal Pattern with Cached Binary Byte Histogram.

Opt
class Opt

Optional Sub Pattern count times.

Patt
class Patt

Base Pattern.

Rep
class Rep

Repetition Sub Pattern count times.

SPatt
class SPatt

Abstract Super Pattern.

SPatt1
class SPatt1

Abstract Singleton Super Pattern.

Seq
class Seq

Sequence of Patterns.

Functions

kwd
Seq kwd(Arg arg)

Keyword arg.

shebangLine
auto ref shebangLine(Patt interpreter)

Create Matcher for a UNIX Shell $(LUCKY Shebang) Pattern.

Meta

Authors

TODO Overload operators & (and), ! (not),

TODO Add pattern for expressing inference with infer (infer ((x instanceOf X) & (X subClassOf Y)) (x instaceOf Y))

TODO Variables are either - _ (ignore) - _x, _y, etc - _'x', _'y' - _!0, _!1, ..., _!(n-1)

infer(rel!desire(_!x, _!y) && rel!madeOf(_!z, _!y), rel!desire(_!x, _!z))

TODO Support variables of specific types and inference using predicate logic: infer(and(fact(var!'x', rel'desire', var!'y'), fact(var!'z', opt(rel'madeOf', rel'instanceOf'), var!'y'))), pred(var!'x', rel'desire', var!'z' ))

TODO Make returns from factory functions immutable. TODO Reuse return patterns from Lit

TODO const s = seq(al..lit,pha.lit); const t = al.lit ~ pha.lit; assert(s !is t); assert(equal(s, t));