LR(1) Parser Initial
This commit is contained in:
parent
0e4f4228de
commit
7b276e1005
8 changed files with 161 additions and 46 deletions
26
Parser/private/CLR.cpp
Normal file
26
Parser/private/CLR.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "CLR.hpp"
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
using namespace tp;
|
||||
|
||||
void CLR::setGrammar(const tp::CfGrammar& grammar) {
|
||||
if (grammar.isLooped()) {
|
||||
mState = ParserState::FAILED;
|
||||
mBuildError.description = "Cant build lalr parser from looped context free grammar";
|
||||
return;
|
||||
}
|
||||
|
||||
mState = ParserState::FAILED;
|
||||
}
|
||||
|
||||
void CLR::setTerminal(const String& name, TerminalStream::TerminalID id) {
|
||||
|
||||
}
|
||||
|
||||
void CLR::build() {
|
||||
|
||||
}
|
||||
|
||||
void CLR::parse(TerminalStream* source, List<ASTNode>& out, ASTNode** root) {
|
||||
*root = nullptr;
|
||||
}
|
||||
|
|
@ -202,4 +202,8 @@ void CfGrammar::deinitializeCfGrammarParser(CfGrammarParserState* state) {
|
|||
|
||||
bool CfGrammar::parse(CfGrammarParserState* context, const String& source) {
|
||||
return ::parse(source.read(), &context->automata, &context->tokenizer, this);
|
||||
}
|
||||
}
|
||||
|
||||
bool CfGrammar::isLooped() const {
|
||||
return mIsLooped;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue