lazix

dfa.h

Apr 13th, 2021 (edited)
742
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma once
  2. #include "lexer.h"
  3. #include <map>
  4. #include <utility>
  5.  
  6.  
  7.  
  8. extern int state_count;
  9. class DFA
  10. {
  11.     public:
  12.     DFA() // everything a DFA needs
  13.     {
  14.         this->m_State = this->m_Init = 0;
  15.  //       this->m_Transitions.erase();
  16.        
  17.        
  18.     }
  19.     ~DFA()
  20.     {
  21.         //this->m_StateContainer
  22.     }
  23.     void add_transition(int);
  24.     void add_state(int);
  25.     int input(lexer::token);
  26.     char* states_S
  27.     /*void add_transition(lexer::token in, int dest)
  28.     {
  29.         this->m_Init = this*;
  30.         this->m_State = 1; // process of transitioning
  31.         int i = 0;
  32.         this->m_Transitions.insert(in);
  33.     }*/
  34.     int m_StateCalculator()
  35.     {
  36.         switch(this->m_State)
  37.         {
  38.             case 0:
  39.             case 1:
  40.         }
  41.     }
  42.     private:
  43.         uint16_t m_State; // this->m_State
  44.         uint8_t m_Init; // this->m_Init
  45.         size_t sizeof_state;
  46.         std::map<lexer::token, int> m_Transitions;
  47.     /* bool operator++
  48.     {
  49.         return
  50.     }*/
  51.     std::pair<lexer::token, uint16_t> m_StateContainer;
  52.     uint8_t m_StateAccepting: 2;
  53.     uint8_t m_StateDeclined: 2;
  54.     int m_StateFinal;
  55. };
  56.  
  57. class Alphabet
  58. {
  59.     public:
  60.     Alphabet()
  61.     {      
  62.     }
  63.     ~Alphabet()
  64.     {
  65.     }
  66.     std::vector<char> symbols; // sigma in nfa
  67.     char get_symbol(int);
  68.     private:
  69.    
  70. };
  71.  
RAW Paste Data