home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / py2s152.zip / Parser / metagrammar.c < prev    next >
C/C++ Source or Header  |  1999-06-27  |  4KB  |  184 lines

  1. /***********************************************************
  2. Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
  3. The Netherlands.
  4.  
  5.                         All Rights Reserved
  6.  
  7. Permission to use, copy, modify, and distribute this software and its
  8. documentation for any purpose and without fee is hereby granted,
  9. provided that the above copyright notice appear in all copies and that
  10. both that copyright notice and this permission notice appear in
  11. supporting documentation, and that the names of Stichting Mathematisch
  12. Centrum or CWI or Corporation for National Research Initiatives or
  13. CNRI not be used in advertising or publicity pertaining to
  14. distribution of the software without specific, written prior
  15. permission.
  16.  
  17. While CWI is the initial source for this software, a modified version
  18. is made available by the Corporation for National Research Initiatives
  19. (CNRI) at the Internet address ftp://ftp.python.org.
  20.  
  21. STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
  22. REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
  23. MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
  24. CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
  25. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  26. PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  27. TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  28. PERFORMANCE OF THIS SOFTWARE.
  29.  
  30. ******************************************************************/
  31.  
  32. #include "pgenheaders.h"
  33. #include "metagrammar.h"
  34. #include "grammar.h"
  35. #include "pgen.h"
  36. static arc arcs_0_0[3] = {
  37.     {2, 0},
  38.     {3, 0},
  39.     {4, 1},
  40. };
  41. static arc arcs_0_1[1] = {
  42.     {0, 1},
  43. };
  44. static state states_0[2] = {
  45.     {3, arcs_0_0},
  46.     {1, arcs_0_1},
  47. };
  48. static arc arcs_1_0[1] = {
  49.     {5, 1},
  50. };
  51. static arc arcs_1_1[1] = {
  52.     {6, 2},
  53. };
  54. static arc arcs_1_2[1] = {
  55.     {7, 3},
  56. };
  57. static arc arcs_1_3[1] = {
  58.     {3, 4},
  59. };
  60. static arc arcs_1_4[1] = {
  61.     {0, 4},
  62. };
  63. static state states_1[5] = {
  64.     {1, arcs_1_0},
  65.     {1, arcs_1_1},
  66.     {1, arcs_1_2},
  67.     {1, arcs_1_3},
  68.     {1, arcs_1_4},
  69. };
  70. static arc arcs_2_0[1] = {
  71.     {8, 1},
  72. };
  73. static arc arcs_2_1[2] = {
  74.     {9, 0},
  75.     {0, 1},
  76. };
  77. static state states_2[2] = {
  78.     {1, arcs_2_0},
  79.     {2, arcs_2_1},
  80. };
  81. static arc arcs_3_0[1] = {
  82.     {10, 1},
  83. };
  84. static arc arcs_3_1[2] = {
  85.     {10, 1},
  86.     {0, 1},
  87. };
  88. static state states_3[2] = {
  89.     {1, arcs_3_0},
  90.     {2, arcs_3_1},
  91. };
  92. static arc arcs_4_0[2] = {
  93.     {11, 1},
  94.     {13, 2},
  95. };
  96. static arc arcs_4_1[1] = {
  97.     {7, 3},
  98. };
  99. static arc arcs_4_2[3] = {
  100.     {14, 4},
  101.     {15, 4},
  102.     {0, 2},
  103. };
  104. static arc arcs_4_3[1] = {
  105.     {12, 4},
  106. };
  107. static arc arcs_4_4[1] = {
  108.     {0, 4},
  109. };
  110. static state states_4[5] = {
  111.     {2, arcs_4_0},
  112.     {1, arcs_4_1},
  113.     {3, arcs_4_2},
  114.     {1, arcs_4_3},
  115.     {1, arcs_4_4},
  116. };
  117. static arc arcs_5_0[3] = {
  118.     {5, 1},
  119.     {16, 1},
  120.     {17, 2},
  121. };
  122. static arc arcs_5_1[1] = {
  123.     {0, 1},
  124. };
  125. static arc arcs_5_2[1] = {
  126.     {7, 3},
  127. };
  128. static arc arcs_5_3[1] = {
  129.     {18, 1},
  130. };
  131. static state states_5[4] = {
  132.     {3, arcs_5_0},
  133.     {1, arcs_5_1},
  134.     {1, arcs_5_2},
  135.     {1, arcs_5_3},
  136. };
  137. static dfa dfas[6] = {
  138.     {256, "MSTART", 0, 2, states_0,
  139.      "\070\000\000"},
  140.     {257, "RULE", 0, 5, states_1,
  141.      "\040\000\000"},
  142.     {258, "RHS", 0, 2, states_2,
  143.      "\040\010\003"},
  144.     {259, "ALT", 0, 2, states_3,
  145.      "\040\010\003"},
  146.     {260, "ITEM", 0, 5, states_4,
  147.      "\040\010\003"},
  148.     {261, "ATOM", 0, 4, states_5,
  149.      "\040\000\003"},
  150. };
  151. static label labels[19] = {
  152.     {0, "EMPTY"},
  153.     {256, 0},
  154.     {257, 0},
  155.     {4, 0},
  156.     {0, 0},
  157.     {1, 0},
  158.     {11, 0},
  159.     {258, 0},
  160.     {259, 0},
  161.     {18, 0},
  162.     {260, 0},
  163.     {9, 0},
  164.     {10, 0},
  165.     {261, 0},
  166.     {16, 0},
  167.     {14, 0},
  168.     {3, 0},
  169.     {7, 0},
  170.     {8, 0},
  171. };
  172. static grammar _PyParser_Grammar = {
  173.     6,
  174.     dfas,
  175.     {19, labels},
  176.     256
  177. };
  178.  
  179. grammar *
  180. meta_grammar()
  181. {
  182.     return &_PyParser_Grammar;
  183. }
  184.