目录
目录README.md

Build Status License Platforms

Gramophone

Swift library for working with Extended Backus–Naur Form (EBNF) notation and the resulting grammars.

Features:

  • Accepts a variety of BNF syntaxes
  • Computes FIRST and FOLLOW sets

⚠️ This library is still a work-in-progress. It definitely still has some issues.

Integration

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/ChimeHQ/Gramophone")
]

Supported Syntax

single_quote_terminal = 'value';
double_quote_terminal = "value";
unicode_scalar = U+0000;

concatenation = a, b, c;
implicit_concatenation = a b c;
alternation = a | b | c;
optional = [a, b];
tailing_optional = a?;
repetition = {a};
grouping = (a, b, c);
exception = a - b;

arrow_assigment → a;
colon_colon_equals_assigment ::= a;

Usage

let grammar = try parser.parseGrammar("test = 'a' | 'b';")

let firstMap = grammar.computeFirstMap()
let followMap = grammar.computeFollowMap()

Suggestions or Feedback

We’d love to hear from you! Get in touch via an issue or pull request.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

关于
106.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号