peg 8.1.1
peg: ^8.1.1 copied to clipboard
Command line tool for generating a PEG (with some syntactic sugar) parsers
8.1.1 #
- Fixed bugs.
8.1.0 #
- Internal breaking changes that do not affect parser generation.
- Improved quality of generated code. Generated code became smaller in size.
- Fixed bugs.
8.0.4 #
- Fixed bugs.
- Improved new expression printer. Now the printer also prints the code blocks of
Actionexpressions.
8.0.3 #
- Fixed bugs
- A new expression printer has been implemented. At the moment, printing of the source code of the expression
Actionhas not yet been implemented.
8.0.2 #
- Added minor modifications to the grammar mathematical formula evaluator.
8.0.1 #
- Fixed bugs and minor improvements have been made.
- Added an example of the mathematical formula evaluator with support for variables and functions.
8.0.0 #
- Breaking change: The way to specify when, where and how to generate errors has been simplified and standardized. Full information can be found in the file
README.md.
7.0.6 #
- Fixed a bug in the number parsing algorithm in the
example/number,peggrammar.
7.0.5 #
- Fixed bugs and minor improvements have been made.
7.0.4 #
- Fixed bugs and minor improvements have been made.
7.0.3 #
- Minor improvements to the binary search generator.
- Minor corrections have been made to the
PEGgrammar (Range Char).
7.0.2 #
- Fixed bugs and minor improvements have been made.
7.0.1 #
- Fixed a bug in printing repetition expressions created using syntactic sugar.
7.0.0 #
- Breaking change:
- Improved reliability by using records for result return.
- Changed the behavior of semantic variables, Only the special variable
$can return a result. This allows to slightly increase the speed by explicitly defining the need for the result.
6.0.4 #
- Fixed a bug in generating negated character classes.
6.0.3 #
- To make it easier to find rules for which the result type was not determined automatically, a non-nullable result type
Objectwill be assigned.
6.0.2 #
- Some typos have been corrected.
- Added information about the naming convention for expression result types.
- Added information on how to generate the parser programmatically.
- The
Stateclass has been updated with many functions for parsing strings and characters.
6.0.1 #
- The
commentoption was not taken into account
6.0.0 #
- Everything was implemented from scratch. There are breaking changes.
5.0.1 #
- Changes in the grammar file
bin/peg.peg. - Added meta expression
@tag() - Changes in the file
README.md.
5.0.0 #
- Error generation algorithms have been slightly reworked.
- Breaking change: Removed meta expression
@errorHandler(). - Breaking change: The
And Predicateexpression no longer returns a result. For consistency of these expressions&expr == !(!expr). - Added meta expression
@indicate(). - Added meta expression
@message(). - Changes in the file
README.md.
4.0.7 #
- Removed unnecessary code from file
helper.dart. - Minor changes to the binary search source code.
4.0.6 #
- The code generator for generating binary search expressions (for predicates and transitions) has been implemented in a new way. It generates reliable but not optimized code. The source code is then optimized to produce an optimal source code.
4.0.5 #
- The source code for supporting the parser runtime has been reworked.
- The generated code has been optimized for some cases of using the expressions
OneOrMoreGeneratorandZeroOrMoreGenerator. - The error post-processing system has been slightly improved. With a few changes, it is now possible to reduce the number of errors generated at runtime when parsing characters, without losing information about the actual errors. Because such errors can be recovered without any problems at the end of the parsing, if the parsing fails. This results in a slight increase in overall parsing performance (5-20%), especially in cases where increasing performance is almost impossible.
- Code generation for parsing literals has been improved.
4.0.4 #
- Fixed bug in method
matchLiteralAsync(). - Code generation for
OrderedChoiceconsisting of literals only has been improved. - Changes to the
csv.peggrammar file.
4.0.3 #
- The implementation of the generated code for the meta expression
@errorHandlerhas been reworked, all calculations are performed in the handler without accessing methods of theStateclass. - The implementation of the generated code for the meta expression
@expectedhas been reworked, all calculations are performed in the handler without accessing methods of theStateclass. - The source code for supporting the parser runtime has been changed. The no longer needed methods
canHandleErrorandrollbackErrorshave been removed. Added a new fieldint lastFailPosto theStateclass. - Changes to the
calc.peggrammar file.
4.0.2 #
- Fixed bugs in
CutExpression. The correct behavior is to apply this expression only to the child expressions of the parent expressionSequenceExpressionand does not apply to child expressions of child expressions of the parent. Its scope is also limited by its parent. - Breaking changes: Meta expressions
@sepByand@sepBy1have been replaced with meta expressions@listand@list1. This was done for the reason that the old expressions did not allow the use of the expressioncut.
4.0.1 #
- Changes in the file
README.md. - Changes to the
calc.peggrammar file. - Changes to the
csv.peggrammar file. - Changes to the
json.peggrammar file. - Due to the fact that PEG does not have the expression
character, but onlycharacter class, the error classErrorExpectedCharacterwas removed. For the reason that there is no way to syntactically declare in the grammar whether a range of characters with one element is a character or a range of characters (with one range). Using the error classErrorExpectedCharactertogether with a range of characters (character class) can lead to ambiguous perception of such error messages. - The source code for supporting the parser runtime has been reworked.
- Added
@eofmeta expression. - Added
@expectedmeta expression.
4.0.0 #
- Now creating a stream parser will not be difficult. Buffering of input data occurs automatically. Clearing the buffer (during parsing) of unnecessary data also occurs automatically. The new
cutexpression serves as a marker to keep track of unnecessary input data. An attempt to parse inaccessible input data (removed from the buffer) is completely excluded at the grammar level, that is, at the parsing level. The grammar developer independently determines where (in what position of parsing the input data) it is useful to cut off the input data by insertingcutexpressions into the grammar. - A new expression
cuthas been implemented. - A new expression
sepBy1has been implemented.
3.0.4 #
- Changes in the file
README.md. - The implementation of methods for parsing characters and strings has been reworked and improved. Also, unused methods of this type are not included in the source code of the generated parser if they are not used.
3.0.3 #
- Changed implementation of the asynchronous parsing algorithm. The source code generated by asynchronous parsers now looks more natural and readable, and at the same time it now works a little faster (about 10%). New asynchronous parsing algorithm is easier to maintain and improve.
3.0.2 #
- The generated source code for parsing terminal expressions has been optimized. The synchronous parser is now faster.
3.0.1 #
- Since support for generation of streaming parsers has been implemented, support for parsing directly from files, without using
Stream"is no longer supported. All relevant code will be removed, resulting in a reduction in runtime code size and a slight increase in parsing performance. Accordingly, support for parsing fromvirtualstrings viaStringReaderwill be removed and parsing will be done directly fromStringvalues.
3.0.0 #
- Breaking and new features. Added implementation of automatic generation of converters. The converter is generated into a separate file. This required changes to the command line tools to unify the way classes and file names are named. To continue normal operation, it is need to rename the grammar file, removing the suffix
_parserfrom the file name, if one would be used in the name of the grammar file (eg. renamejson_parser.pegtojson.peg).
2.0.2 #
- Changes in the file
example_parse_from_stream.dart. - Changes in terminal expression parsing algorithms. The order of statements has been changed.
2.0.1 #
- Changes in the file
example_parse_from_stream.dart. - Implemented the ability to statistic buffer loading during streaming parsing. Added field
ChunkedParsingSink.bufferLoad.
2.0.0 #
- Changes in the file
README.md. - Added example file
example_parse_from_stream.dart. - Implemented support for generating asynchronous code in the
ProductionRuleGeneratorgenerator. - Implemented support for generating asynchronous code in the
AndPredicateGeneratorgenerator. - Implemented support for generating asynchronous code in the
AnyCharacterGeneratorgenerator. - Implemented support for generating asynchronous code in the
BufferGeneratorgenerator. - Implemented support for generating asynchronous code in the
CharacterClassGeneratorgenerator. - Implemented support for generating asynchronous code in the
ErrorHandlerClassGeneratorgenerator. - Implemented support for generating asynchronous code in the
LiteralGeneratorgenerator. - Implemented support for generating asynchronous code in the
NotPredicateGeneratorgenerator. - Implemented support for generating asynchronous code in the
OneOrMoreGeneratorgenerator. - Implemented support for generating asynchronous code in the
OptionalGeneratorgenerator. - Implemented support for generating asynchronous code in the
OrderedChoiceGeneratorgenerator. - Implemented support for generating asynchronous code in the
RepetitionGeneratorgenerator. - Implemented support for generating asynchronous code in the
SepByGeneratorgenerator. - Implemented support for generating asynchronous code in the
SequenceGeneratorgenerator. - Implemented support for generating asynchronous code in the
SliceGeneratorgenerator. - Implemented support for generating asynchronous code in the
StringCharsGeneratorgenerator. - Implemented support for generating asynchronous code in the
VerifyGeneratorgenerator. - Implemented support for generating asynchronous code in the
ZeroOrMoreGeneratorgenerator.
1.0.33 #
- Changes in the file
README.md. - Changes in the file
example/json_parser.peg. Removed result type in rule definitionsArrayandStringChars. - Added
@stringCharsmeta expression. Improves the efficiency of parsing string characters. By definition,string charactersmean the characters between the opening and closing quotes, including escape sequences.
1.0.32 #
- Fixed a bug in the
JSONgrammar example. An incorrect range of characters was specified for parsing hex numbers.
1.0.31 #
- Changes in the implementation of the
_OrderedChoiceGenerator2. - Changes in the implementation of the
_NotPredicateGenerator2. - Changes in the implementation of the
SymbolGenerator. - Changes in the implementation of the
_ZeroOrMoreGenerator3. - Changes to the
peg_parser.peggrammar files. - Changes in the file
README.md.
1.0.30 #
- Changes in the file
README.md. - Change in project description.
- Changes in project dependencies. Removed dependency on
dart_style. - Changes (improvements and bug fixes) in the implementation of the
_OrderedChoiceGenerator2.
1.0.29 #
- Breaking change. To avoid situations where error registration in the
@verifymeta expression handler may be performed incorrectly, the error registration procedure has been simplified. The local variableParseError? erroris now intended for this purpose. If this variable is set to a value in the handler, this will mean that the verification was completed unsuccessfully and this error must be registered. - Breaking change. To avoid situations where error registration in the
@errorHandlermeta expression handler may be performed incorrectly, the error registration procedure has been simplified. The local variableParseError? erroris now intended for this purpose. Also, to implement the ability to roll back last errors, the local variablerollbackErrorswill be available. - Changes in the file
README.md.
1.0.28 #
- Fixed bug in PEG grammar. Fixed errors related to incorrect implementation of parsing rules for the native type
Record.
1.0.27 #
- Changes (improvements and bug fixes) in the implementation of the
@verifymeta expression. To correctly implement the ability to roll back errors registered during parsing, which ends successfully, the implementation of a specific mechanism is required. Such a mechanism was implemented in this meta expression. To use this mechanism, a local functionfail(ParseError error)is declared in this meta expression. This is the function that should be used to register an error instead of directly calling the methods of thestateinstance.
1.0.26 #
- Breaking change: The value type of parsing events is now
enum. The type name is formed from the name of the parser with the wordEventadded at the end (example,JsonParser=>JsonParserEvent). Using an enumeration makes it easier to control how event values are handled in aswitchstatement. Also, the use of values of theEnumtype increases the performance of theswitchstatement compared to processing values of theStringtype. - Changes to the
json_parser.peggrammar example file.
1.0.25 #
- Changes in the file
README.md. - Changes in the implementation of
OrderedChoiceGeneratorandZeroOrMoreGenerator. - Changes in the implementation of
CharacterClassGenerator. - Fixed a bug in the implementation of
SymbolGenerator. Events were not generated for rules with the annotation@inline. - Added example file
example_parse_events.dart.
1.0.24 #
- Changes to the
peg_parser.peggrammar files. Added aNativeIdentifierproduction rule to parse native identifier.
1.0.23 #
- Added example file
example_parse_from_file.dart. - Changes in the file
README.md. - Changes in the file
pubspec.yaml. - Fixed a bug in the implementation of
VerifyGenerator.
1.0.22 #
- Breaking change: The return type of the expression
Sequencewith more than one element has changed if semantic variables are not specified. Previously, a result with typeRecord(with positional fields) was returned, now a result with typeList<Object?>is returned. This is done so as not to overload the system for automatically inferring the type of results returned. Because using theRecordtype as the return type by default leads to an exponential increase in the number of types for fields of theRecordtype (where the fields refer to anotherRecordand so on very deeply), since theRecordtype is a very informative type and contains a huge amount of information.
1.0.21 #
- Fixed a bug in the implementation of
rangesToPredicate().
1.0.20 #
- Due to the large number of rules without specifying types, the automatic inference of the result type may hangs for a long time. To resolve this situation, an exception will be thrown with instructions to temporarily specify the types directly in the grammar.
1.0.19 #
- Changes to the
csv_parser.pegandjson_parser.peggrammar example files. For some production rules, the result type descriptions have been removed since the result types is inferred automatically. - Changes to the
peg_parser.peggrammar files.
1.0.18 #
- Changes to the
csv_parser.pegandjson_parser.peggrammar example files. - Changes in the implementation of
CharacterClassExpression.toString() - Changes in the implementation of
ProductionRule.toString() - Breaking change: The order of the production rule attributes has been changed. Metadata must be specified before specifying the result type.
- The generator now generates documenting comments for the production rules. The rule definition is used as text.
1.0.17 #
- Changes to the
json_parser.peggrammar example file. - Added
@sepBymeta expression.
1.0.16 #
- Added example file
example.dart. - Added the
tool/build.dartfile for generating grammar example files with the current version of the generator. - Added example file
example/build_examples.dart. - Changes in the file
README.md. - Fixed different bugs.
1.0.15 #
- Fixed a bug in the implementation of
Utf8Reader.indexOf(). - Added
@matchStringmeta expression.
1.0.14 #
- The files
README.mdandCHANGELOG.mdhave been translated into English.
1.0.12 #
- Added implementation examples of
Utf8ReaderandFileReader.
1.0.11 #
- The
AndPredicateActionExpressionexpression has been removed due to the fact that the functionality of this expression can easily be implemented using the@verifymeta-expression.
1.0.10 #
- Correction in checking the possibility of optimizing the code generated by the
OrderedChoiceGeneratorgenerator. - A new PEG parser has been generated, example files have been generated.
- Added
@verifymeta expression.
1.0.9 #
- Optimization of the code generated by the
OrderedChoiceGeneratorgenerator.
1.0.8 #
- Changed the implementation of the error handler. The error handler is implemented through a meta expression. The new handler is also made more reliable and easier to understand.
- The concept of meta-expressions has been added to the PEG grammar syntax.
1.0.7 #
- Added
AndPredicateActionExpression.
1.0.6 #
- Optimization of the code generated by the
SliceGeneratorgenerator has been cancelled. - Changes to the
json_parser.peggrammar example file. - Changes to the grammar example file
calc_parser.peg.
1.0.5 #
- Optimization of the code generated by the
OptionalGeneratorgenerator. - Optimization of the code generated by the
ZeroOrMoreGeneratorgenerator. - Changes to the
json_parser.peggrammar example file.
1.0.4 #
- Added documentation for universal top-level parsing functions from
runtimecode.
1.0.3 #
- Fixed a bug in the
csv_parser.peggrammar example.
1.0.2 #
- Changes to PEG grammar regarding escaped characters.
1.0.1 #
- Added an example of a CSV parser.
1.0.0 #
- A new version. Second life of the project.
0.0.54 #
- Fixed bug in
CharacterClassExpressionGenerator - Fixed bug in
LiteralExpressionGenerator - Modified example grammar
arithmetic.peg
0.0.53 #
- Added grammar analyzer
PredicatesWithOptionalExpressionsFinder - Added grammar analyzer
PredicatesWithEmptyExpressionsFinder
0.0.52 #
- Fixed bug in
ExpressionGenerator
0.0.51 #
- Fixed minor bug in
InfiniteLoopFinder
0.0.50 #
- For the better error reporting used the package
parser_errorin some parsers
0.0.49 #
- In function
_failurecorrected the conditions of the detection ofunterminatedtokens
0.0.48 #
- Added "How to write a good PEG grammar" recommendation 'how_to_write_a_good_peg_grammar.md'
- Added a trace statistic about how and why the generator determines the kind of the production rules. Can help a lot for writing good grammar. Command line
peg stat -d high grammar.peg - Significant improvements in the recognition of the production rule kinds: sentences (non-terminals), lexemes (tokens) and morphemes (100% recognition)
0.0.47 #
- Removed
TODOremarks in the generated parsers
0.0.46 #
- Improving the mechanism for determining at runtime the ways of the elimination of the double memoization for the rules in the lowest layers. Previous way was a restriction (at the parser generation stage but not at runtime) on the memoization for all morphemes. Now it is more adaptive and can optimize the caching strategies at runtime for all kins of rules that allows memoization
0.0.45 #
- Disabled memoization for morphemes
0.0.44 #
- Added optional parameter
offsetin method_text() - Fixed bug in
SequenceExpressionGeneratorwith assigning the variable_startPosin sequences with single expression
0.0.43 #
- Added missing option values
lower_casefor formatter commandstylize
0.0.42 #
- Experimental feature. Lazy memoization. Production rules that are marked by the generator as a "can be memorized" rules are turned off by default by the parser in runtime. Only on demand, when parser detects the real requirement of caching, they will be turned on. This feature allows do not perform necessarily caching of results if they was requested only once at some position. Behavior of each rule at runtime is tracked individually
0.0.40 #
- Minor changes in caching mechanics.
0.0.39 #
- Added semantic variable
$startwhich point out to the beginning of the current sequence of expressions - Experimental feature. Changing word compound of production rule name via the grammar formatter
pegfmt. Eg.pegfmt stylize -morpheme upper_case grammar.peg
0.0.38 #
- Changed algorithm of determining the lexical production rules. This was required to provide correct support of results of direct recursion elimination (via
pegfmt). From now results of these transformations fully supported by the front-end recognizer (TerminalRulesFinder)
0.0.37 #
- Experimental feature. Elimination of the direct left recursion via the grammar formatter
pegfmt. Eg.pegfmt recursion grammar.peg
0.0.36 #
- Changes in
MethodFailureGenerator. Improves the handling errors in method_failure. Error messages now more informative
0.0.35 #
- Fixed minor bugs with error messages
0.0.34 #
- Fixed bug in
StartCharactersResolver
0.0.33 #
- Added the binary search algorithm to method
getState(determiner of the current state through the symbol transitions) in a generatedgeneralparsers. This feature improves the performance of the parsing of a complex grammar with a wide range of used input symbols
0.0.32 #
- Fixed bug in
OrderedChoiceExpressionGeneratorassociated with incomplete coverage of range in symbol transitions
0.0.31 #
- Added grammar formatter utility
pegfmt.dart - Fixed bug in
_text() => String
0.0.30 #
- Minor (speed up) changes in
jsongrammar. From now the generatedjson_parseris a fast enough parser, given the fact that it is the generated PEG parser - Minor (speed up) changes in
peggrammar - Minor (speed up) changes in expression resolvers
0.0.29 #
- Fixed bug in
LeftRecursionsFinder
0.0.28 #
- Improved implementation of the symbol transition code generation
0.0.27 #
- Added initial support and implementation of the symbol transitions. The complex grammar should be parsed faster
0.0.25 #
- Fixed a very small bug in the creation of the parser error
- Improved statistic information in the command
stat
0.0.24 #
- Added recognition and error reporting of the
malformed tokens(eg, number's) - Added recognition and error reporting of the
unterminated tokens(eg, string's) - Added statistic information in the command
statabout theexpected lexemesin the non-terminals. Can be used for visual analyzing of the quality of the developed grammar and the proposed error messages on the failures - Fixed bugs in the grammar
example/json.peg(thanks to the newly added recognition and error reporting of themalformed tokens)
0.0.23 #
- Added function
errors() => List<ParserError> - Breaking change. Removed 'line' and 'column' properties.
- Refactored the entire codebase for easiest implementing several kinds of parser generators
- Started the improvements of the error messages. From now all the parser errors are an instances of
XxxParserErrortype.
0.0.21 #
- Fixed bug in
_matchString - Removed convention on a naming terminals and non-terminals in favor to the possibility of analyzing (and control) the grammar on the subject of the auto generated representation names of terminals
0.0.20 #
- Added statistics about an auto generated names of the terminals (they used in the error messages). This feature useful for correcting grammar for better perception of the components of the grammar
- Fixed bugs in
ExpectationResolver(error messages about the expected lexemes are now more correct)
0.0.19 #
- Added full functional example of json parser
- Fixed bug in
CharacterClassExpressionGenerator
0.0.18 #
- Fixed bug in
AndPredicateExpressionGenerator(was missed character;in the template after refactoring)
0.0.16 #
- Added initial support of the tokens for improving the errors messages and support of the upcoming AST generator
- Was improved the basic ("expectation") error messages
0.0.15 #
- Added instruction optimizer in the interpreter parser
- Added the subordination of terminals (master, slave, master/slave). In some cases this can helps developers to writing (after the analyzing) grammar better and, also, this helps for the generator to better optimize the grammar and helps to improve error messages
- Breaking change: All methods, except the starting rules, are now private methods in all parsers. This is done for the interoperability of the generated parsers, better error messaging and performance improvement of parsing processes
0.0.12 #
- Added new parser generator: interpreter parser
- Minor bug fixes
0.0.11 #
- Restored the previous performance (which has been decreased due to the support of the Unicode characters) through the addition of a pre-generated ASCII strings table
0.0.10 #
- Bug fixes for the full support of the Unicode characters
0.0.9 #
- Fixed bugs (the character code units are not an Unicode characters)
- Parser now supports the Unicode characters (uses 32-bit runes instead of 16-bit code units)
0.0.8 #
- Medium improvements of performance by reducing restrictions on the prediction on optional rules without semantic actions
0.0.7 #
- Minor improvements in the expression generators (reduction of the
breakstatements)
0.0.6 #
- Fixed bug in the original peg grammar in
COMMENT
0.0.3 #
- Added an example of the usage of a simple
arithmeticgrammar - Added an example of the usage of a simple
arithmeticgrammar
0.0.2 #
- Small fixes in
bin/peg.dart