summaryrefslogtreecommitdiffhomepage
path: root/bnf.h
blob: 148b6d1cec6ee149b00d139f140a58b20c611647 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#pragma once

#include <deque>
#include <unordered_map>
#include <set>
#include <string>
#include <utility>
#include <vector>

using BNF = std::unordered_map<std::string, std::vector<std::vector<std::string>>>;

std::unordered_map<std::string, std::set<std::string>> Reverse(BNF bnf); // unused now, remove?
std::unordered_map<std::string, std::set<std::string>> reverseFirst(BNF bnf);

BNF SubBNF(const BNF& bnf, const std::string& top);

bool isTerminal(const BNF& bnf, const std::string& symbol);