tmp
This commit is contained in:
parent
65cb26a627
commit
1ead32d84a
71 changed files with 199 additions and 282 deletions
43
.wip/Language/tests/Test.hpp
Normal file
43
.wip/Language/tests/Test.hpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#pragma once
|
||||
|
||||
// #include "SimpleParser.hpp"
|
||||
|
||||
const char* gGrammar = R"(
|
||||
# Grammar in the CF-RE United Format (Defined by language module)
|
||||
|
||||
Rules : {
|
||||
ScopeList : ScopeList Scope | Scope ;
|
||||
Scope : \ScopeBegin StatementList \ScopeEnd;
|
||||
StatementList : StatementList Statement \StatementEnd;
|
||||
StatementList : Statement \StatementEnd;
|
||||
Statement : \StatementBody;
|
||||
}
|
||||
|
||||
Terminals : {
|
||||
Space : " " | "\t" | "\n" | "\r";
|
||||
ScopeBegin : "{";
|
||||
ScopeEnd : "}";
|
||||
StatementEnd : ";";
|
||||
StatementBody : "a" | "b";
|
||||
}
|
||||
|
||||
Start : Scope;
|
||||
Ignore : Space;
|
||||
)";
|
||||
|
||||
const char* gSentence = R"(
|
||||
{}
|
||||
|
||||
{ }
|
||||
|
||||
{
|
||||
a;
|
||||
a ; a ;
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
a;
|
||||
a;
|
||||
}
|
||||
)";
|
||||
45
.wip/Language/tests/Tests.cpp
Normal file
45
.wip/Language/tests/Tests.cpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
#include "Test.hpp"
|
||||
|
||||
/*
|
||||
using namespace tp;
|
||||
|
||||
void testAutomation() {
|
||||
|
||||
FiniteStateAutomation<char, int> automata;
|
||||
|
||||
auto start = automata.addState(0, false);
|
||||
auto end = automata.addState(1, true);
|
||||
|
||||
automata.addTransition(start, end, 'a');
|
||||
|
||||
automata.setStartState(start);
|
||||
|
||||
automata.makeDeterministic();
|
||||
}
|
||||
|
||||
void test() {
|
||||
auto parser = SimpleParser<int1>();
|
||||
|
||||
parser.compileTables(gGrammar, String::Logic::calcLength(gGrammar));
|
||||
auto result = parser.parse(gSentence, String::Logic::calcLength(gSentence));
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
tp::ModuleManifest* deps[] = { &tp::gModuleLanguage, nullptr };
|
||||
tp::ModuleManifest testModule("Test", nullptr, nullptr, deps);
|
||||
|
||||
if (!testModule.initialize()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
testAutomation();
|
||||
test();
|
||||
|
||||
testModule.deinitialize();
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
int main() { return 0; }
|
||||
Loading…
Add table
Add a link
Reference in a new issue