diff --git a/src/LR0.cpp b/src/LR0.cpp index e6b0c31f..2566b4cb 100644 --- a/src/LR0.cpp +++ b/src/LR0.cpp @@ -26,6 +26,7 @@ #include #include +#include //////////////////////////////////////////////////////////////////////////////// LR0::LR0 () @@ -33,3 +34,27 @@ LR0::LR0 () } //////////////////////////////////////////////////////////////////////////////// +void LR0::createParseTables (Grammar& grammar) +{ +} + +//////////////////////////////////////////////////////////////////////////////// +std::string LR0::dump () const +{ + std::stringstream out; + + // TODO Render _actions and _goto as a table. + // + // +-------+---------------+---------------+ + // | state | actions... | goto... | + // | | terminals $ | non-terminals | + // +-------+-----------+---+----+-----+----+ + // | | | | | | | + // +-------+-----------+---+----+-----+----+ + // | | | | | | | + // +-------+-----------+---+----+-----+----+ + + return out.str (); +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/LR0.h b/src/LR0.h index 9195741b..267ac34e 100644 --- a/src/LR0.h +++ b/src/LR0.h @@ -27,10 +27,22 @@ #ifndef INCLUDED_LR0 #define INCLUDED_LR0 +#include +#include +#include + class LR0 { public: LR0 (); + void createParseTables (Grammar&); + std::string dump () const; + +private: + // state column result + // | | | + std::map > _actions; + std::map > _goto; }; #endif