inputparser test/changes

This commit is contained in:
kwullaer 2017-01-27 13:51:56 +01:00 committed by Robin Jadoul
parent f071cb2dec
commit 818386de56
6 changed files with 893 additions and 148 deletions

View File

@ -13,8 +13,6 @@ namespace pds {
static Config parseInput(std::istream& is);
private:
static void lexColon(ParsodusLexer& lex, ParsodusLexer::Token &token, bool nextoken = true);
};
/**

50
include/Parsodus/parser.h Normal file
View File

@ -0,0 +1,50 @@
#pragma once
#ifndef PARSODUS_PARSER_H
#define PARSODUS_PARSER_H
#include "ParsodusLexer.h"
#include "parsodusParser.h"
#include "config.h"
#include <deque>
namespace pds {
class Parser : public parsodusParser<std::unique_ptr<Config>> {
public:
Parser(ParsodusLexer lex);
protected:
Token lex() override;
std::unique_ptr<Config> reduce_0(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_1(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_2(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_3(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_4(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_5(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_6(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_7(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_8(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_9(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_10(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_11(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_12(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_13(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_14(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_15(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_16(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_17(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_18(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_19(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_20(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_21(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_22(std::deque<Token> subparts) override;
std::unique_ptr<Config> reduce_23(std::deque<Token> subparts) override;
private:
ParsodusLexer m_lex;
int m_precedenceCounter = 0;
};
}
#endif // PARSODUS_PARSER_H

View File

@ -0,0 +1,426 @@
#pragma once
#ifndef PARSODUS_PARSER_parsodusParser_H
#define PARSODUS_PARSER_parsodusParser_H
#include <cassert>
#include <cstdint>
#include <deque>
#include <stack>
#include <stdexcept>
#include <vector>
/**
* Represents the type of the symbol (both terminals and nonterminals)
*/
enum class parsodusParser_Symbol : std::uint64_t {
T_EOF,
T_ARROW,
T_COLON,
T_GRAMMAR,
T_LEFT,
T_LEXESIS,
T_LEXESISNAME,
T_NONASSOC,
T_PARSER,
T_PARSERTYPE,
T_PIPE,
T_PRECEDENCE,
T_RIGHT,
T_RULENAME,
T_SEMICOLON,
T_START,
T_TERMINAL,
T_TERMINALS,
T_VARIABLE,
V_bodies,
V_body,
V_error,
V_precedence,
V_precedences,
V_rule,
V_rules,
V_section,
V_sections,
V_term_var,
V_terminals,
};
class SyntaxError : public std::runtime_error {
public:
SyntaxError(const char* c) : std::runtime_error(c) {}
};
template <typename Value>
class parsodusParser {
public:
parsodusParser() {}
virtual ~parsodusParser() {}
/**
* Parse it
*/
Value parse();
protected:
/**
* A token, consisting of a Symbol type (should be a terminal) and a Value
*/
struct Token {
Token(const parsodusParser_Symbol& sym, const Value& val) : symbol(sym), value(val) {}
Token(const parsodusParser_Symbol& sym, Value&& val) : symbol(sym), value(std::move(val)) {}
parsodusParser_Symbol symbol;
Value value;
};
/******************************************
* Functions to be supplied by the user *
******************************************/
/**
* Handle an error
* current is the current Token, one that has no action associated in the current state
* expected is a listing of all terminals that do have an action
*
* By default throws an error
*/
virtual Value error(Token current, const std::vector<parsodusParser_Symbol>& expected);
/**
* Get the next token from the lexer
*/
virtual Token lex() = 0;
/**
* Apply a reduction (a grammar rule in reverse)
*/
virtual Value reduce_0(std::deque<Token> subparts) = 0;
virtual Value reduce_1(std::deque<Token> subparts) = 0;
virtual Value reduce_10(std::deque<Token> subparts) = 0;
virtual Value reduce_11(std::deque<Token> subparts) = 0;
virtual Value reduce_12(std::deque<Token> subparts) = 0;
virtual Value reduce_13(std::deque<Token> subparts) = 0;
virtual Value reduce_14(std::deque<Token> subparts) = 0;
virtual Value reduce_15(std::deque<Token> subparts) = 0;
virtual Value reduce_16(std::deque<Token> subparts) = 0;
virtual Value reduce_17(std::deque<Token> subparts) = 0;
virtual Value reduce_18(std::deque<Token> subparts) = 0;
virtual Value reduce_19(std::deque<Token> subparts) = 0;
virtual Value reduce_2(std::deque<Token> subparts) = 0;
virtual Value reduce_20(std::deque<Token> subparts) = 0;
virtual Value reduce_21(std::deque<Token> subparts) = 0;
virtual Value reduce_22(std::deque<Token> subparts) = 0;
virtual Value reduce_23(std::deque<Token> subparts) = 0;
virtual Value reduce_3(std::deque<Token> subparts) = 0;
virtual Value reduce_4(std::deque<Token> subparts) = 0;
virtual Value reduce_5(std::deque<Token> subparts) = 0;
virtual Value reduce_6(std::deque<Token> subparts) = 0;
virtual Value reduce_7(std::deque<Token> subparts) = 0;
virtual Value reduce_8(std::deque<Token> subparts) = 0;
virtual Value reduce_9(std::deque<Token> subparts) = 0;
private:
};
template <>
class parsodusParser<bool> {
public:
parsodusParser() {}
virtual ~parsodusParser() {}
/**
* Parse it
*/
bool parse();
protected:
/******************************************
* Functions to be supplied by the user *
******************************************/
/**
* Get the next token from the lexer
*/
virtual parsodusParser_Symbol lex() = 0;
};
#define TABLE parsodusParser___Table___parsodusParser
#define REDUCE_COUNT parsodusParser___Num_Reduces___parsodusParser
// Not a static member because the table should not be replicated for different instantiations of the parser
extern const std::uint64_t TABLE[43][30];
extern const unsigned char REDUCE_COUNT[24];
enum Action {
ERROR = 0,
SHIFT = 1,
REDUCE = 2,
ACCEPT = 3
};
/*********************************************
* Translate a Symbol to a readable string *
*********************************************/
inline std::string to_string(parsodusParser_Symbol s) {
switch (s) {
case parsodusParser_Symbol::T_EOF:
return "T_EOF";
case parsodusParser_Symbol::T_ARROW:
return "T_ARROW";
case parsodusParser_Symbol::T_COLON:
return "T_COLON";
case parsodusParser_Symbol::T_GRAMMAR:
return "T_GRAMMAR";
case parsodusParser_Symbol::T_LEFT:
return "T_LEFT";
case parsodusParser_Symbol::T_LEXESIS:
return "T_LEXESIS";
case parsodusParser_Symbol::T_LEXESISNAME:
return "T_LEXESISNAME";
case parsodusParser_Symbol::T_NONASSOC:
return "T_NONASSOC";
case parsodusParser_Symbol::T_PARSER:
return "T_PARSER";
case parsodusParser_Symbol::T_PARSERTYPE:
return "T_PARSERTYPE";
case parsodusParser_Symbol::T_PIPE:
return "T_PIPE";
case parsodusParser_Symbol::T_PRECEDENCE:
return "T_PRECEDENCE";
case parsodusParser_Symbol::T_RIGHT:
return "T_RIGHT";
case parsodusParser_Symbol::T_RULENAME:
return "T_RULENAME";
case parsodusParser_Symbol::T_SEMICOLON:
return "T_SEMICOLON";
case parsodusParser_Symbol::T_START:
return "T_START";
case parsodusParser_Symbol::T_TERMINAL:
return "T_TERMINAL";
case parsodusParser_Symbol::T_TERMINALS:
return "T_TERMINALS";
case parsodusParser_Symbol::T_VARIABLE:
return "T_VARIABLE";
case parsodusParser_Symbol::V_bodies:
return "V_bodies";
case parsodusParser_Symbol::V_body:
return "V_body";
case parsodusParser_Symbol::V_error:
return "V_error";
case parsodusParser_Symbol::V_precedence:
return "V_precedence";
case parsodusParser_Symbol::V_precedences:
return "V_precedences";
case parsodusParser_Symbol::V_rule:
return "V_rule";
case parsodusParser_Symbol::V_rules:
return "V_rules";
case parsodusParser_Symbol::V_section:
return "V_section";
case parsodusParser_Symbol::V_sections:
return "V_sections";
case parsodusParser_Symbol::V_term_var:
return "V_term_var";
case parsodusParser_Symbol::V_terminals:
return "V_terminals";
}
}
/**************************
* Default error method *
**************************/
template <typename Value>
Value parsodusParser<Value>::error(Token current, const std::vector<parsodusParser_Symbol>& expected) {
std::string msg = "Syntax Error: got " + to_string(current.symbol) + "\n Expected any of:";
for (auto& s : expected) {
msg += "\n " + to_string(s);
}
throw SyntaxError(msg.c_str());
}
/***************************
* Parser implementation *
***************************/
template <typename Value>
Value parsodusParser<Value>::parse() {
std::stack<Token> valueStack;
std::stack<std::uint64_t> stateStack;
stateStack.push(0);
Token tok = lex();
while (true) {
std::uint64_t act = TABLE[stateStack.top()][static_cast<std::uint64_t>(tok.symbol)];
switch (act & 0x3) {
case ERROR:
{
constexpr std::uint64_t verr = static_cast<std::uint64_t>(parsodusParser_Symbol::V_error);
std::vector<parsodusParser_Symbol> expected;
std::uint64_t top = stateStack.top();
for (std::uint64_t i = 0; i <= static_cast<std::uint64_t>(parsodusParser_Symbol::T_VARIABLE); i++) {
if ((TABLE[top][i] & 0x3) != ERROR)
expected.emplace_back(static_cast<parsodusParser_Symbol>(i));
}
Token report = Token{tok.symbol, std::move(tok.value)};
Value errorVal = error(std::move(report), expected);
while (!valueStack.empty() && (TABLE[stateStack.top()][verr] & 0x3) == ERROR) {
valueStack.pop();
stateStack.pop();
}
if ((TABLE[stateStack.top()][verr] & 0x3) == ERROR) {
throw SyntaxError("Syntax error: could not recover");
}
stateStack.push(TABLE[stateStack.top()][verr] >> 2);
valueStack.emplace(Token{ parsodusParser_Symbol::V_error, std::move(errorVal)});
while (tok.symbol != parsodusParser_Symbol::T_EOF && (TABLE[stateStack.top()][static_cast<std::uint64_t>(tok.symbol)] & 0x3) == ERROR) {
tok = lex();
}
if ((TABLE[stateStack.top()][static_cast<std::uint64_t>(tok.symbol)] & 0x3) == ERROR) {
throw SyntaxError("Syntax error: could not recover");
}
}
break;
case SHIFT:
valueStack.emplace(std::move(tok));
stateStack.push(act >> 2);
tok = lex();
break;
case REDUCE:
{
std::uint64_t tmp = act >> 2;
parsodusParser_Symbol symbol = static_cast<parsodusParser_Symbol>(tmp >> 31);
std::uint32_t rule = tmp & ((1ull << 31) - 1);
std::deque<Token> dq;
for (unsigned char i = 0; i < REDUCE_COUNT[rule]; i++) {
dq.emplace_front(std::move(valueStack.top()));
valueStack.pop();
stateStack.pop();
}
switch (rule) {
case 0:
valueStack.emplace(symbol, reduce_0(std::move(dq)));
break;
case 1:
valueStack.emplace(symbol, reduce_1(std::move(dq)));
break;
case 2:
valueStack.emplace(symbol, reduce_2(std::move(dq)));
break;
case 3:
valueStack.emplace(symbol, reduce_3(std::move(dq)));
break;
case 4:
valueStack.emplace(symbol, reduce_4(std::move(dq)));
break;
case 5:
valueStack.emplace(symbol, reduce_5(std::move(dq)));
break;
case 6:
valueStack.emplace(symbol, reduce_6(std::move(dq)));
break;
case 7:
valueStack.emplace(symbol, reduce_7(std::move(dq)));
break;
case 8:
valueStack.emplace(symbol, reduce_8(std::move(dq)));
break;
case 9:
valueStack.emplace(symbol, reduce_9(std::move(dq)));
break;
case 10:
valueStack.emplace(symbol, reduce_10(std::move(dq)));
break;
case 11:
valueStack.emplace(symbol, reduce_11(std::move(dq)));
break;
case 12:
valueStack.emplace(symbol, reduce_12(std::move(dq)));
break;
case 13:
valueStack.emplace(symbol, reduce_13(std::move(dq)));
break;
case 14:
valueStack.emplace(symbol, reduce_14(std::move(dq)));
break;
case 15:
valueStack.emplace(symbol, reduce_15(std::move(dq)));
break;
case 16:
valueStack.emplace(symbol, reduce_16(std::move(dq)));
break;
case 17:
valueStack.emplace(symbol, reduce_17(std::move(dq)));
break;
case 18:
valueStack.emplace(symbol, reduce_18(std::move(dq)));
break;
case 19:
valueStack.emplace(symbol, reduce_19(std::move(dq)));
break;
case 20:
valueStack.emplace(symbol, reduce_20(std::move(dq)));
break;
case 21:
valueStack.emplace(symbol, reduce_21(std::move(dq)));
break;
case 22:
valueStack.emplace(symbol, reduce_22(std::move(dq)));
break;
case 23:
valueStack.emplace(symbol, reduce_23(std::move(dq)));
break;
default:
assert(false); //There should be no such rule
break;
}
stateStack.push(TABLE[stateStack.top()][static_cast<std::uint64_t>(valueStack.top().symbol)] >> 2);
}
break;
case ACCEPT:
assert(stateStack.size() == 2);
assert(valueStack.size() == 1);
return std::move(valueStack.top().value);
default:
//IMPOSSIBLE
break;
}
}
}
#undef REDUCE_COUNT
#undef TABLE
#endif /* PARSODUS_PARSER_parsodusParser_H */

View File

@ -1,5 +1,6 @@
#include "ParsodusLexer.h"
#include "Parsodus/inputparser.h"
#include "Parsodus/parser.h"
#include "Parsodus/util/parserType.h"
namespace pds {
@ -10,150 +11,7 @@ namespace pds {
}
Config InputParser::parseInput(std::istream& is) {
ParsodusLexer lex(is);
Config config;
bool readingTerminals = false;
bool readingGrammar = false;
bool readingPrecedences = false;
try {
while(true) {
ParsodusLexer::Token token = lex.nextToken();
if(token.type != ParsodusLexer::TERMINAL)
readingTerminals = false;
if(token.type != ParsodusLexer::TERMINAL
&& token.type != ParsodusLexer::ARROW
&& token.type != ParsodusLexer::VARIABLE
&& token.type != ParsodusLexer::SEMICOLON
&& token.type != ParsodusLexer::PIPE)
readingGrammar = false;
switch(token.type) {
case ParsodusLexer::PARSER:
lexColon(lex, token);
if(token.type == ParsodusLexer::PARSERTYPE) {
config.parserType = token.content;
} else {
throw InputParserException("inputfile malformed, no parser type found in parser section");
}
break;
case ParsodusLexer::LEXESIS:
lexColon(lex, token);
if(token.type != ParsodusLexer::LEXESISNAME)
throw InputParserException("No valid input file found after 'lexesis', found '" + token.content + "' instead.");
config.lexesisFile = token.content;
break;
case ParsodusLexer::TERMINALS:
lexColon(lex, token, false);
readingTerminals = true;
break;
case ParsodusLexer::GRAMMAR:
lexColon(lex, token, false);
readingGrammar = true;
break;
/*
case ParsodusLexer::PRECEDENCES:
lexColon(lex, token, false);
readingPrecedences = true;
break;
*/
case ParsodusLexer::TERMINAL:
if(readingTerminals) {
config.grammar.terminals.insert(token.content.substr(1, token.content.size() - 2));
} else {
throw InputParserException("Found a terminal outside a grammar or terminals section: " + token.content);
}
break;
case ParsodusLexer::START:
lexColon(lex, token);
if(token.type != ParsodusLexer::VARIABLE)
throw InputParserException("Expected to find a start variable, but found: " + token.content);
config.grammar.start = token.content.substr(1, token.content.size() - 2);
break;
case ParsodusLexer::VARIABLE:
if(readingGrammar) {
if(config.grammar.variables.find(token.content) == config.grammar.variables.end())
config.grammar.variables.insert(token.content.substr(1, token.content.size() - 2));
std::string current_head = token.content.substr(1, token.content.size() - 2);
// Parsing rule
token = lex.nextToken();
if(token.type != ParsodusLexer::ARROW)
throw InputParserException("No arrow found after '"+ current_head+"', but found '" + token.content + "' instead");
std::shared_ptr<Rule> rule = std::make_shared<Rule>();
rule->head = current_head;
bool parsing_head = true;
while(parsing_head) {
token = lex.nextToken();
token.content = token.content.substr(1, token.content.size() - 2);
switch(token.type) {
case ParsodusLexer::VARIABLE:
rule->tail.push_back(token.content);
break;
case ParsodusLexer::TERMINAL:
rule->tail.push_back(token.content);
break;
case ParsodusLexer::SEMICOLON:
parsing_head = false;
case ParsodusLexer::PIPE:
rule->tail.shrink_to_fit();
config.grammar.rules.push_back(std::make_shared<Rule>(*rule));
rule->tail.clear();
break;
default:
throw InputParserException("Expecting to find a variable, terminal, pipe or a semicolon, but found '" + token.content + "' instead");
}
}
} else
throw InputParserException("Found a variable outside a grammar section: " + token.content);
break;
/*
case ParsodusLexer::PRECEDENCE:
if (readingPrecedences) {
pds::PrecedenceType precedence_type;
switch(token.content) {
case "left":
precedence_type = pds::PrecedenceType::LEFT;
break;
case "nonassoc":
precedence_type = pds::PrecedenceType::NONASSOC;
break;
case "right":
precedence_type = pds::PrecedenceType::RIGHT;
break;
}
int counter = 0;
while (true) {
token = lex.nextToken();
if (token.type == ParsodusLexer::SEMICOLON)
break;
if (token.type != ParsodusLexer::TERMINAL)
throw InputParserException("Expecting to find a terminal, but found '" + token.content + "' instead'");
if (config.grammar.precedence.find(token.type) == config.grammar.precedence)
throw InputParserException("Found same terminal in multiple precedence rules");
config.grammar.precedence.insert(make_pair(token.content.substr(1, token.content.size() - 2), make_pair(counter++, precedence_type)));
}
} else
throw InputParserException("Found a precedence rule outside a precedence section: " + token.content);
*/
default:
break;
}
}
} catch(ParsodusLexer::NoMoreTokens& err) {}
return config;
}
void InputParser::lexColon(ParsodusLexer& lex, ParsodusLexer::Token &token, bool nextoken) {
token = lex.nextToken();
if(token.type != ParsodusLexer::COLON)
throw InputParserException("No colon found before '" + token.content + "'");
if(nextoken)
token = lex.nextToken();
}
Parser parser(lex);
return *parser.parse();
}
}

277
src/parser.cpp Normal file
View File

@ -0,0 +1,277 @@
#include "Parsodus/parser.h"
#include <deque>
namespace pds {
Parser::Parser(ParsodusLexer lex) :
parsodusParser<std::unique_ptr<Config>>(), m_lex(lex) {
}
Parser::Token Parser::lex() {
try {
ParsodusLexer::Token orig = m_lex.nextToken();
std::unique_ptr<Config> cnf;
parsodusParser_Symbol s;
switch(orig.type) {
case ParsodusLexer::PARSER:
s = parsodusParser_Symbol::T_PARSER;
break;
case ParsodusLexer::PRECEDENCE:
s = parsodusParser_Symbol::T_PRECEDENCE;
break;
case ParsodusLexer::LEXESIS:
s = parsodusParser_Symbol::T_LEXESIS;
break;
case ParsodusLexer::TERMINALS:
s = parsodusParser_Symbol::T_TERMINALS;
break;
case ParsodusLexer::START:
s = parsodusParser_Symbol::T_START;
break;
case ParsodusLexer::GRAMMAR:
s = parsodusParser_Symbol::T_GRAMMAR;
break;
case ParsodusLexer::PARSERTYPE:
cnf = std::make_unique<Config>();
cnf->parserType = orig.content;
return Token{ parsodusParser_Symbol::T_PARSERTYPE, cnf };
case ParsodusLexer::LEFT:
cnf = std::make_unique<Config>();
cnf->grammar.precedence["type"] = std::make_pair(0, PrecedenceType::LEFT);
return Token{ parsodusParser_Symbol::T_LEFT, cnf };
case ParsodusLexer::RIGHT:
cnf = std::make_unique<Config>();
cnf->grammar.precedence["type"] = std::make_pair(2, PrecedenceType::RIGHT);
return Token{ parsodusParser_Symbol::T_RIGHT, cnf };
case ParsodusLexer::NONASSOC:
cnf = std::make_unique<Config>();
cnf->grammar.precedence["type"] = std::make_pair(1, PrecedenceType::NONASSOC);
return Token{ parsodusParser_Symbol::T_NONASSOC, cnf };
case ParsodusLexer::LEXESISNAME:
s = parsodusParser_Symbol::T_LEXESISNAME;
break;
case ParsodusLexer::TERMINAL:
cnf = std::make_unique<Config>();
cnf->grammar.terminals.insert(orig.content);
return { parsodusParser_Symbol::T_TERMINAL, cnf };
case ParsodusLexer::VARIABLE:
cnf = std::make_unique<Config>();
cnf->grammar.variables.insert(orig.content);
return { parsodusParser_Symbol::T_VARIABLE, cnf };
case ParsodusLexer::ARROW:
s = parsodusParser_Symbol::T_ARROW;
break;
case ParsodusLexer::SEMICOLON:
s = parsodusParser_Symbol::T_SEMICOLON;
break;
case ParsodusLexer::COLON:
s = parsodusParser_Symbol::T_COLON;
break;
case ParsodusLexer::PIPE:
s = parsodusParser_Symbol::T_PIPE;
break;
case ParsodusLexer::RULENAME:
cnf = std::make_unique<Config>();
cnf->grammar.rules.emplace_back(std::make_shared<Rule>("", std::vector<std::string>{}, orig.content));
return { parsodusParser_Symbol::T_RULENAME, cnf };
default:
break;
}
return Token{ s, nullptr };
} catch(ParsodusLexer::NoMoreTokens) {
return Token{ parsodusParser_Symbol::T_EOF, nullptr };
}
}
std::unique_ptr<Config> Parser::reduce_0(std::deque<Token> subparts) {
// <section> <sections>
// Check whether there are no different parserType's given
if (subparts[0].value->parserType.empty())
subparts[0].value->parserType = subparts[1].value->parserType;
else if (!subparts[1].value->parserType.empty() &&
subparts[1].value->parserType != subparts[0].value->parserType)
throw "Found more than 1 different parser types"; // MODIFY EXCEPTION
// Check whether there are no different lexesisFile's given
if (subparts[0].value->lexesisFile.empty())
subparts[0].value->lexesisFile = subparts[1].value->lexesisFile;
else if (!subparts[1].value->lexesisFile.empty() &&
subparts[1].value->lexesisFile != subparts[0].value->lexesisFile)
throw "Found more than 1 different lexesis files"; // MODIFY EXCEPTION
// Check whether there are no different grammar's given
// Check whether there are no different start terminals given
if (subparts[0].value->grammar.start.empty())
subparts[0].value->grammar.start = subparts[1].value->grammar.start;
else if (!subparts[1].value->grammar.start.empty() &&
subparts[1].value->grammar.start != subparts[0].value->grammar.start)
throw "Found more than 1 different start terminals"; // MODIFY EXCEPTION
// Check whether there are no different variable sets given
if (subparts[0].value->grammar.variables.empty())
subparts[0].value->grammar.variables = subparts[1].value->grammar.variables;
else if (!subparts[1].value->grammar.variables.empty() &&
subparts[1].value->grammar.variables != subparts[0].value->grammar.variables)
throw "Found more than 1 different variable sets"; // MODIFY EXCEPTION
// Check whether there are no different terminal sets given
if (subparts[0].value->grammar.terminals.empty())
subparts[0].value->grammar.terminals = subparts[1].value->grammar.terminals;
else if (!subparts[1].value->grammar.terminals.empty() &&
subparts[1].value->grammar.terminals != subparts[0].value->grammar.terminals)
throw "Found more than 1 different terminal sets"; // MODIFY EXCEPTION
// Check whether there are no different rule sets given
if (subparts[0].value->grammar.rules.empty())
subparts[0].value->grammar.rules = subparts[1].value->grammar.rules;
else if (!subparts[1].value->grammar.rules.empty() &&
subparts[1].value->grammar.rules != subparts[0].value->grammar.rules)
throw "Found more than 1 different rule sets"; // MODIFY EXCEPTION
// Check whether there are no different precedence sets given
if (subparts[0].value->grammar.precedence.empty())
subparts[0].value->grammar.precedence = subparts[1].value->grammar.precedence;
else if (!subparts[1].value->grammar.precedence.empty() &&
subparts[1].value->grammar.precedence != subparts[0].value->grammar.precedence)
throw "Found more than 1 different precedence sets"; // MODIFY EXCEPTION
// REMARK: Everything is now put into subparts[0]
// Set precedence of each rule
for(std::shared_ptr<Rule>& rule : subparts[0].value->grammar.rules) {
if (rule->tail.size() == 0)
rule->precedence = std::make_pair(false,std::make_pair(-1,PrecedenceType::LEFT));
auto prec = subparts[0].value->grammar.precedence.find(rule->tail.back());
if (prec != subparts[0].value->grammar.precedence.end())
rule->precedence = std::make_pair(true,prec);
else rule->precedence = std::make_pair(false,prec);
}
// REMARK: No option yet for explicit rule precedence
return std::move(subparts[0].value);
}
std::unique_ptr<Config> Parser::reduce_1(std::deque<Token> subparts) {
// "PARSER" "COLON" "PARSERTYPE"
return std::move(subparts[2].value);
}
std::unique_ptr<Config> Parser::reduce_2(std::deque<Token> subparts) {
// "LEXESIS" "COLON" "LEXESISNAME"
return std::move(subparts[2].value);
}
std::unique_ptr<Config> Parser::reduce_3(std::deque<Token> subparts) {
// "TERMINALS" "COLON" <terminals>
return std::move(subparts[2].value);
}
std::unique_ptr<Config> Parser::reduce_4(std::deque<Token> subparts) {
// "PRECEDENCE" "COLON" <precedences>
return std::move(subparts[2].value);
}
std::unique_ptr<Config> Parser::reduce_5(std::deque<Token> subparts) {
// "START" "COLON" "TERMINAL"
auto cnf = std::make_unique<Config>();
cnf->grammar.start = *subparts[2].value->terminals.begin();
return std::move(cnf);
}
std::unique_ptr<Config> Parser::reduce_6(std::deque<Token> subparts) {
// "GRAMMAR" "COLON" <rules>
return std::move(subparts[2].value);
}
std::unique_ptr<Config> Parser::reduce_7(std::deque<Token> subparts) {
// "TERMINAL" <terminals>
subparts[1].value->grammar.terminals.insert(*subparts[0].value->grammar.terminals.begin());
return std::move(subparts[1].value);
}
std::unique_ptr<Config> Parser::reduce_8(std::deque<Token> subparts) {
// ""
return std::make_unique<Config>();
}
std::unique_ptr<Config> Parser::reduce_9(std::deque<Token> subparts) {
// <precedence> <terminals> <precedences>
auto other = std::move(subparts[2].value);
subparts.pop_back();
std::unique_ptr<Config> cfg = reduce_10(std::move(subparts));
for(auto& p : cfg->grammar.precedence)
other->grammar.precedence.insert(p);
return std::move(other);
}
std::unique_ptr<Config> Parser::reduce_10(std::deque<Token> subparts) {
// <precedence> <terminals>
PrecedenceType typ = subparts[0].value->grammar.precedence["type"].second;
for (std::string t : subparts[1].value->grammar.terminals) {
subparts[1].value->grammar.precedence[t] = {m_precedenceCounter, typ};
}
m_precedenceCounter++;
return std::move(subparts[1].value);
}
std::unique_ptr<Config> Parser::reduce_11(std::deque<Token> subparts) {
//"LEFT"
return std::move(subparts[0].value);
}
std::unique_ptr<Config> Parser::reduce_12(std::deque<Token> subparts) {
// "RIGHT"
return std::move(subparts[0].value);
}
std::unique_ptr<Config> Parser::reduce_13(std::deque<Token> subparts) {
// "NONASSOC"
return std::move(subparts[0].value);
}
std::unique_ptr<Config> Parser::reduce_14(std::deque<Token> subparts) {
// <rule> <rules>
subparts[1].value->grammar.rules.emplace_back(std::move(subparts[0].value->grammar.rules[0]));
return std::move(subparts[1].value);
}
std::unique_ptr<Config> Parser::reduce_15(std::deque<Token> subparts) {
// <rule>
return std::move(subparts[0].value);
}
std::unique_ptr<Config> Parser::reduce_16(std::deque<Token> subparts) {
//"VARIABLE" "ARROW" <bodies>
std::string head = subparts[0].value->grammar.rules[0]->head;
subparts[0].value->grammar.rules.clear();
for(std::shared_ptr<Rule> rule : subparts[2].value->grammar.rules)
subparts[0].value->grammar.rules.push_back(std::make_shared(Rule(head, rule->tail, rule->name))); // SOMETHING WRONG WITH THIS STATEMENT
return std::move(subparts[0].value);
}
std::unique_ptr<Config> Parser::reduce_17(std::deque<Token> subparts) {
// <body> "PIPE" <bodies>
for(auto rule : subparts[2].value->grammar.rules)
subparts[0].value->grammar.rules.push_back(rule);
return std::move(subparts[0].value);
}
std::unique_ptr<Config> Parser::reduce_18(std::deque<Token> subparts) {
// <body>
return std::move(subparts[0].value);
}
std::unique_ptr<Config> Parser::reduce_19(std::deque<Token> subparts) {
// <term_var> "RULENAME"
subparts[0].value->grammar.rules[0]->name = subparts[1].value->grammar.rules[0]->name;
return std::move(subparts[0].value);
}
std::unique_ptr<Config> Parser::reduce_20(std::deque<Token> subparts) {
// <term_var>
return std::move(subparts[0].value);
}
std::unique_ptr<Config> Parser::reduce_21(std::deque<Token> subparts) {
// <term_var> "VARIABLE"
subparts[0].value->grammar.rules[0]->tail.push_back(subparts[1].value->grammar.rules[0]->tail[0]);
return std::move(subparts[0].value);
}
std::unique_ptr<Config> Parser::reduce_22(std::deque<Token> subparts) {
// <term_var> "TERMINAL"
subparts[0].value->grammar.rules[0]->tail.push_back(subparts[1].value->grammar.rules[0]->tail[0]);
return std::move(subparts[0].value);
}
std::unique_ptr<Config> Parser::reduce_23(std::deque<Token> subparts) {
// ""
auto cnf = std::make_unique<Config>();
cnf->grammar.rules.emplace_back(std::make_shared<Rule>("", {}));
return std::move(subparts[0].value);
}
}

136
src/parsodusParser.cpp Normal file
View File

@ -0,0 +1,136 @@
#include "parsodusParser.h"
#define TABLE parsodusParser___Table___parsodusParser
#define REDUCE_COUNT parsodusParser___Num_Reduces___parsodusParser
const std::uint64_t TABLE[43][30] = {
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (1) << 2),(ERROR | (0) << 2),(SHIFT | (2) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (3) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (4) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (5) << 2),(ERROR | (0) << 2),(SHIFT | (6) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((7) << 2),((8) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (9) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (10) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (11) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (12) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (13) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (14) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (1) << 2),(ERROR | (0) << 2),(SHIFT | (2) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (3) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (4) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (5) << 2),(ERROR | (0) << 2),(SHIFT | (6) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((7) << 2),((15) << 2),((0) << 2),((0) << 2), },
{ (ACCEPT | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (16) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((17) << 2),((18) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (19) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (20) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (21) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (22) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (23) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((24) << 2),((25) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (26) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(SHIFT | (27) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((28) << 2), },
{ (REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_sections) << 31 | 0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(SHIFT | (29) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rules) << 31 | 15) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rules) << 31 | 15) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rules) << 31 | 15) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rules) << 31 | 15) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rules) << 31 | 15) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rules) << 31 | 15) << 2),(SHIFT | (16) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((17) << 2),((30) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 6) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 6) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 6) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 6) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 6) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 6) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 2) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 2) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 2) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 2) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 2) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 2) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 1) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 1) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 1) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 1) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 1) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 1) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 11) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 11) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 11) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 11) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 11) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 11) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 11) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 11) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 11) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 11) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 13) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 13) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 13) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 13) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 13) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 13) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 13) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 13) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 13) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 13) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 12) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 12) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 12) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 12) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 12) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 12) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 12) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 12) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 12) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedence) << 31 | 12) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(SHIFT | (27) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((31) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 4) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 4) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 4) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 4) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 4) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 4) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 5) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 5) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 5) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 5) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 5) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 5) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(SHIFT | (27) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 8) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((32) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 3) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 3) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 3) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 3) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 3) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_section) << 31 | 3) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 23) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 23) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 23) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 23) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 23) << 2),
((33) << 2),((34) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((35) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rules) << 31 | 14) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rules) << 31 | 14) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rules) << 31 | 14) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rules) << 31 | 14) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rules) << 31 | 14) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rules) << 31 | 14) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedences) << 31 | 10) << 2),(SHIFT | (21) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedences) << 31 | 10) << 2),(ERROR | (0) << 2),(SHIFT | (22) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedences) << 31 | 10) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedences) << 31 | 10) << 2),(SHIFT | (23) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedences) << 31 | 10) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedences) << 31 | 10) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((24) << 2),((36) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 7) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 7) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 7) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 7) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 7) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 7) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 7) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 7) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_terminals) << 31 | 7) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (37) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (38) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_bodies) << 31 | 18) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_body) << 31 | 20) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(SHIFT | (39) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_body) << 31 | 20) << 2),(ERROR | (0) << 2),(SHIFT | (40) << 2),(ERROR | (0) << 2),(SHIFT | (41) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedences) << 31 | 9) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedences) << 31 | 9) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedences) << 31 | 9) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedences) << 31 | 9) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedences) << 31 | 9) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_precedences) << 31 | 9) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rule) << 31 | 16) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rule) << 31 | 16) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rule) << 31 | 16) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rule) << 31 | 16) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rule) << 31 | 16) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rule) << 31 | 16) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_rule) << 31 | 16) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 23) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 23) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 23) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 23) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 23) << 2),
((42) << 2),((34) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((35) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_body) << 31 | 19) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_body) << 31 | 19) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 22) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 22) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 22) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 22) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 22) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 21) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 21) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 21) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 21) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_term_var) << 31 | 21) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
{ (ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(REDUCE | (static_cast<std::uint64_t>(parsodusParser_Symbol::V_bodies) << 31 | 17) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),(ERROR | (0) << 2),
((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2),((0) << 2), },
};
const unsigned char REDUCE_COUNT[24] = { 2,3,3,3,3,3,3,2,0,3,2,1,1,1,2,1,4,3,1,2,1,2,2,0, };
bool parsodusParser<bool>::parse() {
std::stack<std::uint64_t> stateStack;
using Sym = parsodusParser_Symbol;
stateStack.push(0);
Sym tok = lex();
while (true) {
std::uint64_t act = TABLE[stateStack.top()][static_cast<std::uint64_t>(tok)];
switch (act & 0x3) {
case ERROR:
return false;
case SHIFT:
stateStack.push(act >> 2);
tok = lex();
break;
case REDUCE:
{
std::uint64_t tmp = act >> 2;
Sym symbol = static_cast<Sym>(tmp >> 31);
std::uint32_t rule = tmp & ((1ull << 31) - 1);
for (unsigned char i = 0; i < REDUCE_COUNT[rule]; i++) {
stateStack.pop();
}
stateStack.push(TABLE[stateStack.top()][static_cast<std::uint64_t>(symbol)] >> 2);
}
break;
case ACCEPT:
assert(stateStack.size() == 2);
return true;
default:
//IMPOSSIBLE
break;
}
}
}