Skip to content

0.4.1

Compare
Choose a tag to compare
@mincrmatt12 mincrmatt12 released this 28 Dec 05:03
· 100 commits to master since this release

(0.4.0 was missing a commit and so is not listed here as a release)

This is a major feature release, vastly improving NMFU's capability for parsing binary protocols, in addition to fixing a number of bugs. There's also now a proper documentation site for NMFU, available at nmfu.rtfd.io.

New Features

  • Expanded type system: (ea5e297)
    • Integers can now have a custom size and signedness: out int{size 4, unsigned} wow;
    • Strings can now be unterminated: out unterminated str[56] look_no_nulls;
  • Conditional blocks: if/elif/else statements now exist (be41210, f3f71de).
  • Expanded expressions:
    • Boolean expressions: || and &&, as well as comparison operators (baa2ba1, 3369969)
    • Better math: unary not and negation (5f24078), string length and indexing (353f391) and bitwise logic/bitshifts (6936042).
    • Better integer literals; now supporting hexadecimal and binary: 0b0110, -0x54 (1e61988)
  • Binary matches (8b2f09b, e202041):
    • Strings and regexes can now be made "binary", where instead of them having characters they instead only contain hex.
    • For example, "f0 0ffa"b or b/ff+ (3456|56 77{2-3})/.
    • This also adds support for \xHH escapes within normal strings.
  • Character constants now support escape sequences (45196d6, 1cdd324)
  • Improved debugging tools for working on NMFU itself:
    • Option for dumping the parse tree for debugging (1b7242a).
    • DFA-dumper can now be asked to show all literals as hex codepoints (3450fa5)
    • Gave conditional actions proper debug names (151eaae)
    • Added dumper for viewing the DTAG tree (c45b4d2)
  • New optimizer that tries to shortcircuit fallthrough transitions if possible (3043adc, db126e2)

Bugs Fixed

  • Better ambiguity detection and resolution for chaining matches, especially those with inverted matches (1026f83).
  • Properly handle actions after certain blocks when there is nothing following them (c5f1806).
  • Correct short-circuit behaviour for action side-effects (such as outofspace handling) (bbda784).
  • More accurate line/column information for errors concerning regexes (92cd8f2).
  • Ensure chaining DFAs doesn't drop error handling-transitions in certain circumstances (64e89f2)
  • Fix DFA.dfs() not properly considering MAY_GOTO_TARGET-type actions, causing the optimizer to mistakenly drop states (ca72b3b)
  • Fixed loop body start actions being ignored (ccb54a3)
  • Macros now bind arguments in a sane way, fixing various problems with nesting them. (8f87354, 6191b42)
  • Fallthrough loop detection now considers multi-state cycles. (222d971)
  • Action-only conditional nodes now properly propagate subsequent actions (ad3a917)
  • Foreach nodes only apply their actions to non-fallthrough transitions to ensure they only run once per character (709d314)
  • Rewrote the majority of the loop implementation to make it more compatible with action side-effects (5b520bb)
  • DTAG system now does more checks for garbage-collection and uses weakrefs to be slightly more memory-efficient (e5d58f3)

Infrastructure Changes

  • Proper documentation, powered by mkdocs (ce5429c) as well as a basic tutorial (a1ea939, 3af8af2, 3897641)
  • New example showcasing binary features which parses TripUpdate messages from a GTFS Realtime feed (f4a2edb, e7c8b1d)
  • Demonstration of more advanced string manipulation in the RDF example (92ff838, 5fa891e)
  • Full integration tests now will run the generated code through an actual compiler to check for correctness. While they're skipped if one isn't found, please make sure any potential patches are tested with one installed. (acbff31)
  • Certain integration tests now check for both compilation success and correct matching (a2fb61a)
  • Code coverage is now reported in CI (2b9152f)
  • More tests, both for new and old features. (lots)