Yxbcvn410 / TwoSidedContextParser

A parser for two-sided context-free grammars

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Two-sided context grammar parser

Information

This program takes a grammar with two-sided contexts and a string of the same alphabet and the generates a derivation tree for it.

The grammar must be written in the extended Backus-Naur notation and match the binary normal form criteria.

The derivation tree generated is in the DOT format, which can be then visualized using GraphViz or this website.

Building

You can build the program with CMake.

boost::program_options is required.

Usage

The string to generate derivation from can be passed via CLI, via stdin or as a file.

Examples:

obparser -g ./tests/an_bn_cn -i aabbcc -o tree.dot
String "aabbcc" will be derived.

obparser aabbcc  -g ./tests/an_bn_cn -o tree.dot
String "aabbcc" will be derived.

obparser -g ./tests/an_bn_cn -f string.txt -o tree.dot
Content of string.txt will be derived.

obparser -g ./tests/an_bn_cn -o tree.dot
> aabbcc
String "aabbcc" will be derived.

Type obparser --help for more info.

About

A parser for two-sided context-free grammars

License:MIT License


Languages

Language:C++ 97.9%Language:CMake 2.1%