Hello all ,
I am very exciting to announce that
Hoa\Compiler 3.16.08.15 has been released, aka the
- Acts like an iterator, which brings constant memory usage while lexing small, medium or huge data,
Parser and rules:
- Reduce method calls, thus indirections,
- Reduce memory with transitional rules,
- Introduce the
Hoa\Compiler\Llk::savemethod to transform an in-memory parser to PHP code (when running, it builds the same parser, state is reset).
- Introduce pragmas with the
%pragmainstructions, two already exist:
lexer.unicodeto enable or disable Unicode support in the lexer,
parser.lookaheadto set the value of
kin LL(k), i.e. the number of tokens to look ahead.
Hoa\Json uses the
lexer.unicode pragmas to fully implementing the RFC7159, especially for the UTF-8 implementation with surrogate pairs format. This library also uses the
parser.lookahead pragma to set
k to 0 (in LL(k)), so we have a LL(0) parser.
- New unit test suites have been written,
- New integration test suites have been written,
- Existing integration test suites have been enhanced,
- 2 bugs have been found and fixed,
- 24 test suites,
- 136 test cases,
- 320,242 assertions.
Yup. Much better. The blog post will detail the numbers but we observe:
- 43-48% less memory in the lexer, and
- 5% faster with the parser compiled to PHP code instead of serialized.
- Publish the blog post,
- Write a
Hoa\Slicelibrary to avoid copies of big arrays in the compiler. We must discuss about that.