tmp
This commit is contained in:
parent
fb8202f385
commit
184f8dd1fe
6 changed files with 128 additions and 71 deletions
|
|
@ -1,10 +1,33 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Automata.hpp"
|
||||
#include "Grammar.hpp"
|
||||
|
||||
namespace tp {
|
||||
|
||||
template <typename tAlphabetType, typename tStateType, tStateType tNoStateVal, tStateType tFailedStateVal>
|
||||
class RegularCompiler {};
|
||||
class ContextFreeCompiler {
|
||||
typedef ContextFreeGrammar Grammar;
|
||||
|
||||
public:
|
||||
// Terminals or non terminals
|
||||
struct Alphabet {
|
||||
String mId;
|
||||
bool mIsTerminal = false;
|
||||
};
|
||||
|
||||
struct Item {
|
||||
Grammar::Rule mRule;
|
||||
ualni mAdvanceIdx;
|
||||
};
|
||||
|
||||
typedef NFA<Alphabet, Item> NFA;
|
||||
typedef typename NFA::Vertex State;
|
||||
|
||||
public:
|
||||
void compile(const Grammar& in, NFA& out) { nfa = &out; }
|
||||
|
||||
private:
|
||||
NFA* nfa = nullptr;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue