home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pyth_os2.zip / python-1.0.2 / Parser / metagrammar.c < prev    next >
C/C++ Source or Header  |  1994-01-03  |  3KB  |  177 lines

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