In this tutorial we're going to build a set of parser combinators.
We'll answer the above question in 2 steps.
- What is a parser?
- and, what is a parser combinator?
So first question: What is parser?
#![feature(inclusive_range_syntax, generators, generator_trait, never_type)] | |
use std::ops::{Generator, GeneratorState}; | |
fn is_div_by(n: u64, modulus: u64) -> bool { | |
if n % modulus == 0 { | |
true | |
} else { | |
false | |
} |