- 授权协议: 未知
- 开发语言: Swift
- 操作系统: OS X
- 软件首页: https://github.com/dparnell/swift-parser-generator
软件介绍
swift-parser-generator 是试验性的 Swift 解析器生成器。
swift parser generator 的代码包括尝试使用 Swift 制作类似 Scala 解析器关系选择器,部分可以成功制作简单的解析器,但是还未实现 Packrat 样式解析器。
// "a" followed by "b"
let rule = "a" ~ "b"
// "a" or "b"
let rule = "a" | "b"
// "a" followed by something other than "b"
let rule = "a" ~ !"b"
// "a" followed by one or more "b"
let rule = "a" ~ "b"+
// "a" followed by zero or more "b"
let rule = "a" ~ "b"*
// "a" followed by a numeric digit
let rule = "a" ~ ("0"-"9")
// "a" followed by the rule named "blah"
let rule = "a" ~ ^"blah"
// "a" optionally follewd by "b"
let rule = "a" ~ "b"/~
// "a" followed by the end of input
let rule = "a"*!*
