Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 7.8% on proxy.golang.org
Top 6.1% forks on proxy.golang.org

proxy.golang.org : modernc.org/ebnf2y

ebnf2y converts EBNF grammars into yacc compatible skeleton .y files. Installation: Usage: Options: File: The EBNF flavor is the one used by the Go language specification[1]: _______________________________________________________________________________ The syntax is specified using Extended Backus-Naur Form (EBNF): Productions are expressions constructed from terms and the following operators, in increasing precedence: Lower-case production names are used to identify lexical tokens. Non-terminals are in CamelCase. Lexical tokens are enclosed in double quotes "" or back quotes “. The form a … b represents the set of characters from a through b as alternatives. The horizontal ellipsis … is also used elsewhere in the spec to informally denote various enumerations or code snippets that are not further specified. The character … (as opposed to the three characters ...) is not a token of the Go language. _______________________________________________________________________________ Many non trivial EBNF grammars will produce shift/reduce conflicts. These must be resolved manually. The generated yacc (*.y) file is a skeleton parser, intended only as a starting point of a real parser. However, for some simple grammars the automatically generated parser might be (almost) useful as it is. This example EBNF[2]: produces a yacc file[3], seen at the link without any edits in its original form as generated by ebnf2y. In conjunction with a simple lexer[4] (any other tokenizer for the particular grammar can be used as well), a simple demo program can be compiled. Running it without arguments prints: Note: In the above output, nil items have been removed from the AST dump before printing. Prerequisites: ebnf2y and golex[4] must be installed. The demo program can be built by: The produced binary 'demo/demo' accepts an expression as the value of its '-e' flag. Default is `fmt.Printf("%d\012", -1 + 2*^3 | 4)`. Links fom the above godocs:

Registry - Source - Documentation - JSON
purl: pkg:golang/modernc.org/ebnf2y
License: BSD-3-Clause
Latest release: over 5 years ago
First release: over 5 years ago
Namespace: modernc.org
Stars: 1 on GitLab.com
Forks: 2 on GitLab.com
See more repository details: repos.ecosyste.ms
Last synced: 3 days ago

    Loading...
    Readme
    Loading...