Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include <set>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <iostream>
  5. #include <vector>
  6. #include <stack>
  7.  
  8. #include <set>
  9. //#include "Grammar.cpp"
  10.  
  11. using namespace std;
  12. class Grammar{
  13. public:
  14. virtual string getType() =0;
  15. virtual string getName () =0;
  16.  
  17. };
  18.  
  19. class Terminal :public Grammar{
  20. private:
  21. string name;
  22. string type;
  23.  
  24. public:
  25. Terminal(string namee){
  26. name = namee;
  27. type = "terminal";
  28. }
  29. string getName(){
  30. return name;
  31. }
  32. string getType(){
  33. return type;
  34. }
  35. };
  36.  
  37. class NonTerminal :public Grammar{
  38. private:
  39. string name;
  40. string type;
  41.  
  42. public:
  43. NonTerminal(string namee){
  44. name = name;
  45. type = "non-terminal";
  46. }
  47. string getName(){
  48. return "non-terminal";
  49. }
  50. string getType(){
  51. return type;
  52. }
  53. set<Terminal> first;
  54. set<Terminal> follow;
  55.  
  56. };
  57.  
  58.  
  59. int main(){
  60. cout<<" jhsajdsa "<<endl;
  61. Grammar* g;
  62. Terminal t("t");
  63. g = &t;
  64. cout<< g->getName();
  65. return 0;
  66.  
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement