Add BNF generation

This commit is contained in:
Greg Shuflin 2022-10-16 01:37:51 -07:00
parent 22d0aa73de
commit 4e711ee898
2 changed files with 7 additions and 0 deletions

1
src/bnf.rs Normal file
View File

@ -0,0 +1 @@
pub struct Bnf {}

View File

@ -1,11 +1,17 @@
#![feature(assert_matches)]
#![allow(dead_code)] //TODO eventually turn this off
mod bnf;
use bnf::Bnf;
use std::rc::Rc;
type ParseResult<I, O, E> = Result<(O, I), E>;
trait Parser<I, O, E> {
fn parse(&self, input: I) -> ParseResult<I, O, E>;
fn bnf(&self) -> Option<Bnf> {
None
}
fn map<'a, F, O2>(self, map_fn: F) -> BoxedParser<'a, I, O2, E>
where