OysterKit is a framework that provides a native Swift scanning, lexical analysis, and parsing capabilities. In addition it provides a language that can be used to rapidly define the rules used by OysterKit called STLR
Swift
Clone or download
SwiftStudies Initial version of structural generation, and legacy compatible new a…
…rchitecture

No source changes are required. Structural generation still needs work, but please do play.
Latest commit 01f2f2a Jul 17, 2018
Permalink
Failed to load latest commit information.
Documentation
Experiments.playground Added profile command (available only on Mac OS 10.14, not on Linux, … Jul 10, 2018
Playgrounds/Example Languages.playground Closes #67 Adding support for regular expressions as terminals. See … Jul 10, 2018
Resources
Scripts Changed STLR to support auto-generation of the intermediate represent… Jul 15, 2018
Sources Fixes #27 Jul 17, 2018
Tests Fixes #27 Jul 17, 2018
.gitignore Clearing up some files that should not be in repository Jul 10, 2018
.swift-version Update .swift-version Jun 17, 2018
.travis.yml Update .travis.yml Jul 14, 2018
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Sep 11, 2017
CONTRIBUTING.md Update CONTRIBUTING.md Sep 11, 2017
LICENSE Added back travis and LICENSE files Sep 11, 2017
Package.resolved Stopped CommandKit from getting downloaded and built Jan 31, 2018
Package.swift Resolving broken test module dependency May 9, 2018
README.md Updated documentation with information on 4.2 development and documen… Jul 9, 2018

README.md

OysterKit

Status
Linux/macOS/iOS/tvOS Build Status
Test Coverage codecov
Documentation Coverage 97%

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:

Key Features

  • 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 Encodable and Decodable)
  • 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

Status

  • 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.