OysterKit enables native Swift scanning, lexical analysis, and parsing capabilities as a pure Swift framework. Two additional elements are also provided in this package. The first is a second framework STLR which uses OysterKit to provide a plain text grammar specification language called STLR (Swift Tool for Language Recognition). Finally a command line tool,
stlr can be used to automatically generate Swift source code for OysterKit for STLR grammars, as well as dynamically apply STLR grammars to a number of use-cases. The following documentation is available:
- OysterKit API Documentation Full API documentation for the OysterKit framework
- STLR API Documentation Full API documentation for the STLR framework
- stlrc Command Line Tool reference Instructions for using the
stlrccommand line tool. Note that some of the tutorials referenced above also provide some concrete usage examples.
- OysterKit Provides support for scanning strings
- Fully supports direct and indirect left hand recursion in rules
- Provides support for parsing strings using defined rules as streams of tokens or constructing Abstract Syntax Trees (ASTs)
- All of the above provided as implementations of protocols allowing the replacement of any by your own components if you wish
- Create your own file decoders (using Swift 4's Encoding/Decoding framework
- STLR Provides support for defining scanning (terminal) and parsing rules
- A lexical analysis and parser definition language, STLR, which can be compiled at run-time in memory, or from stored files
- Complied STLR can be used immediately at run time, or through the generation of a Swift source file
- Swift 4.2 development is proceeding on the 4.2 branch, in addition new features are also being added there. Check the status of the 4.2 pull request to confirm that all tests are passing, but you are safe to use this branch for development if you wish. I have been merging changes into the master branch providing they do not break 4.1.x compatibility.
- All tests are passing
For those that used v1.0 there are significant performance and capability benefits of moving to v2. I have not yet built an OKScript translator, but that could quite easily be done if there is demand.
Help us keep the lights on
0.5.0 - Jul 17, 2018
Some fairly major changes as we progress towards version 1.0. No changes required by any consumers but Swift IntermediateRepresentation autogeneration has been added. There are some issues at this stage, but for the first time you can parse STLR itself and generate the parsing rules and the IR automatically which can then be used to parse STLR.
The new flatter rule system is also included in this release and is thoroughly tested but is not yet consumed by anything. Existing rule implementers don't need to change anything (and may never need to), but internally ParserRules and ScannerRules will be replaced by this new architecture.
Furthermore creating custom (and therefore potentially highly optimised) rules in Swift is now very easy (see ClosureRule).
If any future changes are required they will be minimal.
0.4.0 - Jul 10, 2018
Adds support for regular expressions as terminals. This release works with both Swift 4.1 and 4.2.
0.3.2 - Jun 17, 2018
This version will build and run correctly in both Swift 4.1 and 4.2
0.3.1 - May 9, 2018
Adds support for Swift 4.1, increases the unit test coverage to over 70%.
0.3.0 - Feb 6, 2018
This is a significant release. The API and underlying implementation have been replaced significantly simplifying both.
The remainder of the releases up to v1.0 will now focus on stabilising the STLR language itself (not bugs, but ensuring there is a solid base to build on in future releases, and that any grammar breaking changes are minimised (I am not aware of any that are required at this point, but I will leave the door open)