lazix

dfa.cpp

Apr 13th, 2021 (edited)
604
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "include/dfa.h"
  2. #include <cassert>
  3. #include <algorithm>
  4. void DFA::add_transition(int a, int position)
  5. {
  6.     if(position > m_Transitions.size())
  7.     {
  8.         return 1;
  9.     }
  10.     m_Transitions.insert(a);
  11. }
  12.  
  13. void DFA::add_state(int a)
  14. {
  15.     m_StateContainer.insert(a);
  16.     assert(m_State != m_FinalState);
  17. }
  18.  
  19. friend void m_StateCalculator() // wrapper
  20. {
  21.     sw // obviously wip
  22. }
  23.  
  24. /*int DFA::input(lexer::token lexemes)
  25. {
  26.     auto holder = std::make_pair<lexer::token, int>;
  27.     if(lexemes.input.size() > 0)
  28.     {
  29.         this->m_States = this->m_StatesAccepting;
  30.         std::vector<char>::iterator a = std::find_if(lexemes.input.begin(), lexemes.input.end(),
  31.                 [lexemes]()
  32.                 {  
  33.                     return lexemes ?
  34.                 }
  35.                 );
  36.         this->m_State = *holder;
  37.         return m_State;
  38.     }
  39.     else
  40.     {
  41.         this->m_States = this->m_StatesAccepting;
  42.         return 0;
  43.     }
  44. }*/
  45.  
  46. char Alphabet::get_symbol(int position)
  47. {
  48.     if(position < symbols.size())
  49.     {
  50.         return 1;
  51.     }
  52.     char result;
  53.     std::vector<char>::iterator c = symbols.begin();
  54.     while(c != symbols.end())
  55.     {
  56.         if(position == *c)
  57.         {
  58.             result = symbols[position];
  59.         }
  60.         else
  61.         {
  62.             c++;  
  63.         }  
  64.         return result;
  65.     }
  66.     return -1;
  67. }
  68. int main()
  69. {
  70.     puts("Hello, DFA.\n");
  71.     return 0;
  72. }
  73. //wip
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×