https://github.com/steshaw/language-swift2-quote
💫 Swift 2.1 parser and pretty-printer 🚧💔😢
https://github.com/steshaw/language-swift2-quote
haskell parser swift swift-2
Last synced: about 1 month ago
JSON representation
💫 Swift 2.1 parser and pretty-printer 🚧💔😢
- Host: GitHub
- URL: https://github.com/steshaw/language-swift2-quote
- Owner: steshaw
- License: bsd-3-clause
- Created: 2016-05-04T02:00:01.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2019-09-15T04:17:57.000Z (almost 7 years ago)
- Last Synced: 2025-07-26T02:56:39.783Z (11 months ago)
- Topics: haskell, parser, swift, swift-2
- Language: Haskell
- Homepage:
- Size: 205 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Quasiquotation for Swift in Haskell
This library will eventually provide quasiquotation support for Swift in
Template Haskell.
## Warning
Unfortunately the Swift 2.1 grammar is quite left recursive -- not just on the
small scale but on a large scale. This was not something I had noticed before
digging right into this project. It looks as though the changes for Swift 3
might make some things easier in this regard (though I haven't checked the
grammar closely). Much of this parser may be reusable for Swift 3. I would
recommend using a [grammar checking
tool](http://smlweb.cpsc.ucalgary.ca/start.html) prior to encoding the Swift 3
grammar in parser combinators.
## Resources
- [Swift 5.1 Grammar Summary](https://docs.swift.org/swift-book/ReferenceManual/zzSummaryOfTheGrammar.html)
## TODO
- [ ] Upgrade to 5.1 🤣.
- [ ] Fix "large scale" left-recursion.
- [ ] remaining `pattern` productions.
- [ ] Replace interim `identifier` parser with one that meets the spec.
- [ ] `getter-setter-keyword-block` (currently disguised as simply `getter-setter-block`).
- [ ] expressions need to use `chainr` and `chainl`.
- [ ] missing/incomplete rendering functions.
- [ ] additional test cases:
- [ ] closures and closure signatures
- [ ] availability conditions
- [ ] protocol members
- [ ] nested expressions
- [ ] enums