home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / dada / turbo.grm < prev    next >
Text File  |  1986-02-27  |  9KB  |  385 lines

  1. start -> turbo
  2.  
  3. turbo   -> program_heading block '.'
  4.  
  5. actual_par -> exp
  6.              -> var
  7.  
  8. actual_par_list -> actual_par
  9.                   -> actual_par_list actual_par
  10.  
  11. adding_op -> '+'
  12.             -> '-'
  13.             -> 'OR'
  14.             -> 'XOR'
  15.  
  16. array_type -> 'ARRAY' '[' index_type_list ']' 'OF' component_type
  17.  
  18. array_var -> var
  19.  
  20. assign_stmt -> var ':=' exp
  21.  
  22. base_type -> simple_type
  23.  
  24. block -> decl_part stmt_part
  25.  
  26. case_element -> case_list ':' stmt
  27.  
  28. case_label -> con
  29.  
  30. case_label_list -> case_label
  31.                   -> case_label_list ',' case_label
  32.  
  33. case_list -> case_list_element
  34.             -> case_list ',' case_list_element
  35.  
  36. case_list_element -> con
  37.                     -> con '..' con
  38.  
  39. case_stmt -> 'CASE' exp 'OF' case_element_list 'END'
  40.             -> 'CASE' exp 'OF' case_element_list 'OTHERWISE' stmt_list 'END'
  41.  
  42. case_element_list -> case_element
  43.                     -> case_element_list ';' case_element
  44.  
  45. comp_factor -> signed_factor
  46.               -> 'NOT' signed_factor
  47.  
  48. component_type -> type
  49.  
  50. component_var -> indexed_var
  51.                 -> field_designator
  52.  
  53. compound_stmt -> 'BEGIN' stmt_list 'END'
  54.  
  55. conditional_stmt -> if_stmt
  56.                    -> case_stmt
  57.  
  58. con -> uns_number
  59.       -> sign uns_number
  60.       -> con_id
  61.       -> sign con_id
  62.       -> string
  63.  
  64. con_def_part -> 'CONST' con_def_list ';'
  65.  
  66. con_def_list -> con_def
  67.                -> con_def_list ';' con_def
  68.  
  69. con_def -> untyped_con_def
  70.           -> typed_con_def
  71.  
  72. con_id -> '<id>'
  73.  
  74. control_character -> '@' uns_integer
  75.  
  76. control_var -> var_id
  77.  
  78. decl_part -> decl_section
  79.             -> decl_part decl_section
  80.  
  81. decl_section -> label_decl_part
  82.                -> con_def_part
  83.                -> type_def_part
  84.                -> var_decl_part
  85.                -> proc_and_func_decl_part
  86.  
  87. empty ->
  88.  
  89. empty_stmt -> empty
  90.  
  91. entire_var -> var_id
  92.              -> typed_con_id
  93.  
  94. exp -> simple_exp relation_list
  95.  
  96. exp_list -> exp
  97.            -> exp_list ',' exp
  98.  
  99. relation_list -> relational_op simple_exp
  100.                 -> relation_list relational_op simple_exp
  101.  
  102. factor -> var
  103.          -> uns_con
  104.          -> exps
  105.          -> func_designator
  106.          -> set
  107.  
  108. exps -> exp
  109.        -> exps exp
  110.  
  111. field_designator -> record_var '.' field_id
  112.  
  113. field_id -> '<id>'
  114.  
  115. field_id_list -> field_id
  116.                 -> field_id_list field_id
  117.  
  118. field_list -> fixed_part
  119.              -> fixed_part ';' variant_part
  120.              -> variant_part
  121.  
  122. file_id -> '<id>'
  123.  
  124. file_id_list -> empty
  125.                -> file_id
  126.                -> file_id_list file_id
  127.  
  128. file_type -> 'FILE' 'OF' type
  129.  
  130. final_value -> exp
  131.  
  132. fixed_part -> record_section
  133.              -> fixed_part ';' record_section
  134.  
  135. for_list -> initial_value 'TO' final_value
  136.            -> initial_value 'DOWNTO' final_value
  137.  
  138. for_stmt -> 'FOR' control_var ':=' for_list 'DO' stmt
  139.  
  140. formal_par_section -> par_group
  141.                      -> 'VAR' par_group
  142.  
  143. func_decl -> func_heading block ';'
  144.  
  145. func_designator -> func_id
  146.                   -> func_id '(' actual_par_list ')'
  147.  
  148. func_heading -> 'FUNCTION' '<id>' ':' result_type ';'
  149.                -> 'FUNCTION' '<id>' '(' formal_par_section_list ')' ':' result_type ';'
  150.  
  151. formal_par_section_list -> formal_par_section
  152.                           -> formal_par_section_list formal_par_section
  153.  
  154. func_id -> '<id>'
  155.  
  156. goto_stmt -> 'GOTO' '<label>'
  157.  
  158. id_list -> '<id>'
  159.           -> id_list '<id>'
  160.  
  161. if_stmt -> 'IF' exp 'THEN' stmt
  162.           -> 'IF' exp 'THEN' stmt 'ELSE' stmt
  163.  
  164. index_type -> simple_type
  165.  
  166. index_type_list -> index_type
  167.                   -> index_type_list ',' index_type
  168.  
  169. indexed_var -> array_var '[' exp_list ']'
  170.  
  171. initial_value -> exp
  172.  
  173. inline_list_element -> uns_integer
  174.                       -> con_id
  175.                       -> var_id
  176.                       -> location_counter_ref
  177.  
  178. inline_list_element_list -> inline_list_element
  179.                            -> inline_list_element_list ',' inline_list_element
  180.  
  181. inline_stmt -> 'INLINE' inline_list_element_list
  182.  
  183. label_decl_part -> 'LABEL' label_list ';'
  184.  
  185. label_list -> '<label>'
  186.              -> label_list ',' '<label>'
  187.  
  188. location_counter_ref -> '*'
  189.                        -> '*' sign con
  190.  
  191. multiplying_op -> '*'
  192.                -> '/'
  193.                -> 'DIV'
  194.                -> 'MOD'
  195.                -> 'AND'
  196.                -> 'SHL'
  197.                -> 'SHR'
  198.  
  199. par_group -> id_list ':' type_id
  200.  
  201. pointer_type -> '^' type_id
  202.  
  203. pointer_var -> var
  204.  
  205. proc_and_func_decl_part -> proc_or_func_decl
  206.                           -> proc_and_func_decl_part proc_or_func_decl
  207.  
  208. proc_decl -> proc_heading block ';'
  209.  
  210. proc_heading -> 'PROCEDURE' '<id>' ';'
  211.                -> 'PROCEDURE' '<id>' '(' formal_par_section_list ')' ';'
  212.  
  213. proc_or_func_decl -> proc_decl
  214.                     -> func_decl
  215.  
  216. proc_stmt -> proc_id
  217.             -> proc_id '(' actual_par_list ')'
  218.  
  219. proc_id -> '<id>'
  220.  
  221. program_heading -> empty
  222.                   -> 'PROGRAM' program_id file_id_list
  223.  
  224. program_id -> '<id>'
  225.  
  226. record_section -> empty
  227.                  -> field_id_list ':' type
  228.  
  229. record_type -> 'RECORD' field_list 'END'
  230.  
  231. record_var -> var
  232.  
  233. record_var_list -> record_var
  234.                   -> record_var_list record_var
  235.  
  236. refd_var -> pointer_var '^'
  237.  
  238. relational_op -> '='
  239.               -> '<>'
  240.               -> '<='
  241.               -> '>='
  242.               -> '<'
  243.               -> '>'
  244.               -> 'IN'
  245.  
  246. repeat_stmt -> 'REPEAT' stmt_list 'UNTIL' exp
  247.  
  248. repetitive_stmt -> while_stmt
  249.                   -> repeat_stmt
  250.                   -> for_stmt
  251.  
  252. result_type -> type_id
  253.  
  254. scalar_type -> '(' id_list ')'
  255.  
  256. scale_factor -> '<digit_seq>'
  257.                -> sign '<digit_seq>'
  258.  
  259. set -> '[' set_element_list ']'
  260.  
  261. set_element -> exp
  262.               -> exp '..' exp
  263.  
  264. set_element_list -> set_element
  265.                    -> set_element_list set_element
  266.  
  267. set_type -> 'SET' 'OF' base_type
  268.  
  269. sign -> '+'
  270.      -> '-'
  271.  
  272. signed_factor -> factor
  273.                 -> sign factor
  274.  
  275. simple_exp -> term
  276.              -> simple_exp adding_op term
  277.  
  278. simple_stmt -> assign_stmt
  279.               -> proc_stmt
  280.               -> goto_stmt
  281.               -> inline_stmt
  282.               -> empty_stmt
  283.  
  284. simple_type -> scalar_type
  285.               -> subrange_type
  286.               -> type_id
  287.  
  288. stmt -> simple_stmt
  289.        -> struc_stmt
  290.  
  291. stmt_list -> stmt
  292.             -> stmt_list ';' stmt
  293.  
  294. stmt_part -> compound_stmt
  295.  
  296. string -> empty
  297.          -> string string_element
  298.  
  299. string_element -> '<text_string>'
  300.                  -> control_character
  301.  
  302. string_type -> 'STRING' '[' con ']'
  303.  
  304. struc_stmt -> compound_stmt
  305.              -> conditional_stmt
  306.              -> repetitive_stmt
  307.              -> with_stmt
  308.  
  309. struc_type -> unpacked_struc_type
  310.              -> 'PACKED' unpacked_struc_type
  311.  
  312. subrange_type -> con '..' con
  313.  
  314. tag_field -> empty
  315.             -> field_id ':'
  316.  
  317. term -> comp_factor
  318.        -> term multiplying_op comp_factor
  319.  
  320. type_def -> '<id>' '=' type
  321.  
  322. type_def_list -> type_def
  323.                 -> type_def_list type_def
  324.  
  325. type_def_part -> 'TYPE' type_def_list ';'
  326.  
  327. type_id -> '<id>'
  328.  
  329. type -> simple_type
  330.        -> struc_type
  331.        -> pointer_type
  332.  
  333. typed_con_def -> 'TYPE' '<id>' '=' con
  334.  
  335. typed_con_id -> '<id>'
  336.  
  337. unpacked_struc_type -> string_type
  338.                       -> array_type
  339.                       -> record_type
  340.                       -> set_type
  341.                       -> file_type
  342.  
  343. uns_con -> uns_number
  344.           -> string
  345.           -> con_id
  346.           -> 'NIL'
  347.  
  348. uns_integer -> '<digit_seq>'
  349.               -> '$' '<hexdigit_seq>'
  350.  
  351. uns_number -> uns_integer
  352.              -> uns_real
  353.  
  354. uns_real -> '<digit_seq>' '.' '<digit_seq>'
  355.            -> '<digit_seq>' '.' '<digit_seq>' 'E' scale_factor
  356.            -> '<digit_seq>' 'E' scale_factor
  357.  
  358. untyped_con_def -> '<id>' '=' con
  359.  
  360. var -> entire_var
  361.       -> component_var
  362.       -> refd_var
  363.  
  364. var_decl -> id_list ':' type
  365.            -> id_list ':' type 'ABSOLUTE' con
  366.  
  367. var_decl_list -> var_decl
  368.                 -> var_decl_list var_decl
  369.  
  370. var_decl_part -> 'VAR' var_decl_list ';'
  371.  
  372. var_id -> '<id>'
  373.  
  374. variant -> empty
  375.           -> case_label_list ':' '(' field_list ')'
  376.  
  377. variant_part -> 'CASE' tag_field type_id 'OF' variant_list
  378.  
  379. variant_list -> variant
  380.                -> variant_list ';' variant
  381.  
  382. while_stmt -> 'WHILE' exp 'DO' stmt
  383.  
  384. with_stmt -> 'WITH' record_var_list 'DO' stmt
  385.