Skip to content

Expressions

Pre-release
Pre-release
Compare
Choose a tag to compare
@mathiasverraes mathiasverraes released this 30 Nov 19:47
· 69 commits to main since this release
  • FEATURE: Expression parser. Using a simple interface, you can define parsers for recursive expression languages with different associativity and operators precedence.

  • FEATURE: Lots of fine grained Psalm type annotations. You should now be able to use Psalm in your own parsers, and get useful warnings if you do something wrong.

  • FEATURE: Parser#thenEof(). Make sure the parser reached the end of the input by appending ->thenEof()

  • IMPROVEMENT: Many error messages are now more clear

  • PERFORMANCE: 10x improvement by generating the error messages lazily. Still a long way before Parsica is performant enough for large scale production usage, but this gives us confidence there's still many low hanging fruits.

  • DOCS: New tutorial about writing expression parsers

  • DOCS: New tutorial about dealing with whitespace

  • DOCS: Added lots of missing API docs

  • DOCS: Improved the tutorial on types

  • DOCS: New examples in tests/Examples for expressions and an quick demo of an Excel formula parser

  • BREAKING: The Fail class no longer does double duty as an exception. Instead, use ParseResult#throw(), which throws a ParserHasFailed exception.

  • BREAKING: Parser#recurse() doesn't return the parser anymore, and instead returns void.

  • BREAKING: Parser#construct(ClassName) is removed in favour of map(fn($v) => new ClassName))

... and lots of minor improvements