-
Notifications
You must be signed in to change notification settings - Fork 7
/
rpc2x.y
2339 lines (1887 loc) · 74.4 KB
/
rpc2x.y
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/** -*-Fundamental-*- *************************************
$Header$
Bison parser generator input for Lojban grammar.
This is developed directly from the LLG's bnf.300 file. A number of extra
tokens are added (in categ.c) so that the parser developed from this
is LALR(1). bnf.300 has been extended in a few areas - for syntax
error handling, and to make certain sub-categories of some rules
directly recognizable in the back-end processing. The same language
should still be recognized as that defined in bnf.300.
The original BNF rules from bnf.300 are shown commented out in this file;
they are those with left-hand sides of the form non-terminal<number>.
With acknowledgements to the Logical Language Group, as discussed at
the top of bnf.300.
The string \* ET *\ indicates where an elidable terminator is
optionally missing from a rule. A perl script (terminator.pl) can be
used to strip these rules, leaving a grammer where all rules are
closed by terminators. By running that grammar through bison, you can
look for residual shift/reduce conflicts, if any. (The only ones left
here result from the error processing.) (There is a small crock for
the <stag gik> case, q.v.).
***************************************/
/* COPYRIGHT */
%token GARBAGE
%token A
%token BAhE
%token BAI
%token BE
%token BEhO
%token BEI
%token BIhE
%token BIhI
%token BO
%token BOI
%token BRIVLA
%token BU
%token BY
%token CAhA
%token CAI
%token CEhE
%token CEI
%token CMENE
%token CO
%token COI
%token CU
%token CUhE
%token DAhO
%token DOhU
%token DOI
%token FA
%token FAhA
%token FAhO
%token FEhE
%token FEhU
%token FIhO
%token FOI
%token FUhA
%token FUhE
%token FUhO
%token GA
%token GAhO
%token GEhU
%token GI
%token GIhA
%token GOhA
%token GOI
%token GUhA
%token I
%token JA
%token JAI
%token JOhI
%token JOI
%token KE
%token KEhE
%token KEI
%token KI
%token KOhA
%token KUhE
%token KUhO
%token KU
%token LA
%token LAhE
%token LAU
%token LE
%token LEhU
%token LI
%token LIhU
%token LOhO
%token LOhU
%token LU
%token LUhU
%token MAhO
%token MAI
%token ME
%token MEhU
%token MOhE
%token MOhI
%token MOI
%token NA
%token NAhE
%token NAhU
%token NAI
%token NIhE
%token NIhO
%token NOI
%token NU
%token NUhA
%token NUhI
%token NUhU
%token PA
%token PEhA
%token PEhE
%token PEhO
%token POhA
%token PU
%token RAhO
%token ROI
%token SA
%token SE
%token SEhU
%token SEI
%token SI
%token SOI
%token SU
%token TAhE
%token TEhU
%token TEI
%token TO
%token TOI
%token TUhE
%token TUhU
%token UI
%token VA
%token VAU
%token VEhA
%token VEhO
%token VEI
%token VIhA
%token VUhO
%token VUhU
%token XI
%token Y
%token ZAhO
%token ZEhA
%token ZEI
%token ZI
%token ZIhE
%token ZO
%token ZOhU
%token ZOI
/* EXTRA TOKENS REQUIRED TO MAKE GRAMMAR LALR(1) */
%token PRIVATE_START_EK
%token PRIVATE_START_GIHEK
%token PRIVATE_START_GUHEK
%token PRIVATE_START_JEK
%token PRIVATE_END_JEK
%token PRIVATE_START_JOIK
%token PRIVATE_END_JOIK
%token PRIVATE_START_GEK
%token PRIVATE_START_BAI
%token PRIVATE_EK_KE
%token PRIVATE_EK_BO
%token PRIVATE_JEK_KE
%token PRIVATE_JEK_BO
%token PRIVATE_JOIK_KE
%token PRIVATE_JOIK_BO
%token PRIVATE_I_JEKJOIK
%token PRIVATE_I_BO
%token PRIVATE_GIHEK_KE
%token PRIVATE_GIHEK_BO
%token PRIVATE_NAhE_BO
%token PRIVATE_NAhE_time
%token PRIVATE_NAhE_space
%token PRIVATE_NAhE_CAhA
%token PRIVATE_NA_KU
%token PRIVATE_NUMBER_MAI
%token PRIVATE_NUMBER_MOI
%token PRIVATE_NUMBER_ROI
%token PRIVATE_START_TENSE
%token PRIVATE_END_TENSE
%token PRIVATE_EOF_MARK
%token IMPOSSIBLE_TOKEN
%{
#define YYDEBUG 1
#include <string.h>
#include "nodes.h"
#include "nonterm.h"
#include "functions.h"
#define YYSTYPE TreeNode *
extern TreeNode *top;
extern void yyerror(const char *);
extern int last_tok_line;
extern int last_tok_column;
%}
%%
/*
text<0> = [NAI ...] [CMENE ... # | (indicators & free ...)] [joik-jek] text-1
*/
all : chunks
;
/*
all : text
;
*/
/* This is an artifact of the error handling mechanism - sometimes the parser will
reduce right out to the top rule which is hopeless */
chunks : text PRIVATE_EOF_MARK
| text error
{ $$ = $1; yyclearin; }
| chunks text PRIVATE_EOF_MARK
| chunks text error
{ fprintf(stderr, "Syntax error following text ending at line %d column %d\n",
@2.last_line, @2.last_column);
yyclearin;
$$ = new_node_2(CHUNKS, $1, $2); }
;
text : NAI_seq CMENE_seq free_seq joik_opt_ke free_seq text_1
| NAI_seq CMENE_seq free_seq jek_opt_ke free_seq text_1
| NAI_seq CMENE_seq free_seq joik_opt_ke text_1
| NAI_seq CMENE_seq free_seq jek_opt_ke text_1
| NAI_seq CMENE_seq free_seq text_1
| NAI_seq CMENE_seq joik_opt_ke free_seq text_1
| NAI_seq CMENE_seq jek_opt_ke free_seq text_1
| NAI_seq CMENE_seq joik_opt_ke text_1
| NAI_seq CMENE_seq jek_opt_ke text_1
| NAI_seq CMENE_seq text_1
| NAI_seq indicators free_seq joik_opt_ke free_seq text_1
| NAI_seq indicators free_seq jek_opt_ke free_seq text_1
| NAI_seq indicators free_seq joik_opt_ke text_1
| NAI_seq indicators free_seq jek_opt_ke text_1
| NAI_seq indicators free_seq text_1
| NAI_seq indicators joik_opt_ke free_seq text_1
| NAI_seq indicators jek_opt_ke free_seq text_1
| NAI_seq indicators joik_opt_ke text_1
| NAI_seq indicators jek_opt_ke text_1
| NAI_seq indicators text_1
| NAI_seq free_seq joik_opt_ke free_seq text_1
| NAI_seq free_seq jek_opt_ke free_seq text_1
| NAI_seq free_seq joik_opt_ke text_1
| NAI_seq free_seq jek_opt_ke text_1
| NAI_seq free_seq text_1
| NAI_seq joik_opt_ke free_seq text_1
| NAI_seq jek_opt_ke free_seq text_1
| NAI_seq joik_opt_ke text_1
| NAI_seq jek_opt_ke text_1
| NAI_seq text_1
| CMENE_seq free_seq joik_opt_ke free_seq text_1
| CMENE_seq free_seq jek_opt_ke free_seq text_1
| CMENE_seq free_seq joik_opt_ke text_1
| CMENE_seq free_seq jek_opt_ke text_1
| CMENE_seq free_seq text_1
| CMENE_seq joik_opt_ke free_seq text_1
| CMENE_seq jek_opt_ke free_seq text_1
| CMENE_seq joik_opt_ke text_1
| CMENE_seq jek_opt_ke text_1
| CMENE_seq text_1
| indicators free_seq joik_opt_ke free_seq text_1
| indicators free_seq jek_opt_ke free_seq text_1
| indicators free_seq joik_opt_ke text_1
| indicators free_seq jek_opt_ke text_1
| indicators free_seq text_1
| indicators joik_opt_ke free_seq text_1
| indicators jek_opt_ke free_seq text_1
| indicators joik_opt_ke text_1
| indicators jek_opt_ke text_1
| indicators text_1
| free_seq joik_opt_ke free_seq text_1
| free_seq jek_opt_ke free_seq text_1
| free_seq joik_opt_ke text_1
| free_seq jek_opt_ke text_1
| free_seq text_1
| joik_opt_ke free_seq text_1
| jek_opt_ke free_seq text_1
| joik_opt_ke text_1
| jek_opt_ke text_1
| text_1
/* | text_no_text_1 */
/* | empty */
;
text_no_text_1 : NAI_seq CMENE_seq free_seq joik_opt_ke free_seq
| NAI_seq CMENE_seq free_seq jek_opt_ke free_seq
| NAI_seq CMENE_seq free_seq joik_opt_ke
| NAI_seq CMENE_seq free_seq jek_opt_ke
| NAI_seq CMENE_seq free_seq
| NAI_seq CMENE_seq joik_opt_ke free_seq
| NAI_seq CMENE_seq jek_opt_ke free_seq
| NAI_seq CMENE_seq joik_opt_ke
| NAI_seq CMENE_seq jek_opt_ke
| NAI_seq CMENE_seq
| NAI_seq indicators free_seq joik_opt_ke free_seq
| NAI_seq indicators free_seq jek_opt_ke free_seq
| NAI_seq indicators free_seq joik_opt_ke
| NAI_seq indicators free_seq jek_opt_ke
| NAI_seq indicators free_seq
| NAI_seq indicators joik_opt_ke free_seq
| NAI_seq indicators jek_opt_ke free_seq
| NAI_seq indicators joik_opt_ke
| NAI_seq indicators jek_opt_ke
| NAI_seq indicators
| NAI_seq free_seq joik_opt_ke free_seq
| NAI_seq free_seq jek_opt_ke free_seq
| NAI_seq free_seq joik_opt_ke
| NAI_seq free_seq jek_opt_ke
| NAI_seq free_seq
| NAI_seq joik_opt_ke free_seq
| NAI_seq jek_opt_ke free_seq
| NAI_seq joik_opt_ke
| NAI_seq jek_opt_ke
| NAI_seq
| CMENE_seq free_seq joik_opt_ke free_seq
| CMENE_seq free_seq jek_opt_ke free_seq
| CMENE_seq free_seq joik_opt_ke
| CMENE_seq free_seq jek_opt_ke
| CMENE_seq free_seq
| CMENE_seq joik_opt_ke free_seq
| CMENE_seq jek_opt_ke free_seq
| CMENE_seq joik_opt_ke
| CMENE_seq jek_opt_ke
| CMENE_seq
| indicators free_seq joik_opt_ke free_seq
| indicators free_seq jek_opt_ke free_seq
| indicators free_seq joik_opt_ke
| indicators free_seq jek_opt_ke
| indicators free_seq
| indicators joik_opt_ke free_seq
| indicators jek_opt_ke free_seq
| indicators joik_opt_ke
| indicators jek_opt_ke
| indicators
| free_seq joik_opt_ke free_seq
| free_seq jek_opt_ke free_seq
| free_seq joik_opt_ke
| free_seq jek_opt_ke
| free_seq
| joik_opt_ke free_seq
| jek_opt_ke free_seq
| joik_opt_ke
| jek_opt_ke
;
/*
text-1<2> = [(I [jek | joik] [[stag] BO] #) ... | NIhO ... #] [paragraphs]
*/
text_1 : text_1A paragraphs
| text_1A
| paragraphs
| /* Empty */
;
text_1A : text_1B
| NIhO_seq_free_seq
;
text_1B : text_1C
| text_1B text_1C
;
/* Differs from i_jj_stag_bo because it allows the construct
without BO at the end . */
text_1C : PRIVATE_I_BO I joik stag BO free_seq
| PRIVATE_I_BO I jek stag BO free_seq
| PRIVATE_I_BO I stag BO free_seq
| PRIVATE_I_BO I joik stag BO
| PRIVATE_I_BO I jek stag BO
| PRIVATE_I_BO I stag BO
| PRIVATE_I_BO I joik BO free_seq
| PRIVATE_I_BO I jek BO free_seq
| PRIVATE_I_BO I BO free_seq
| PRIVATE_I_BO I joik BO
| PRIVATE_I_BO I jek BO
| PRIVATE_I_BO I BO
| PRIVATE_I_JEKJOIK I joik_opt_ke free_seq
| PRIVATE_I_JEKJOIK I jek_opt_ke free_seq
| I free_seq
| PRIVATE_I_JEKJOIK I joik_opt_ke
| PRIVATE_I_JEKJOIK I jek_opt_ke
| I
;
/*
paragraphs<4> = paragraph [NIhO ... # paragraphs]
*/
/* Rewrite <paragraphs> to make this left recursive : important as there may be
lots of these in a text. */
/*
paragraph<10> = (statement | fragment) [I # [statement | fragment]] ...
*/
paragraphs : paragraph
| paragraphs NIhO_seq_free_seq paragraph
;
paragraph : statement
| fragment
| paragraph i_opt_free_seq statement
| paragraph i_opt_free_seq fragment
| paragraph i_opt_free_seq
;
i_opt_free_seq : I
| I free_seq
;
/*
statement<11> = statement-1 | prenex statement
*/
statement : inner_statement
;
inner_statement : statement_1
| prenex inner_statement
;
/*
statement-1<12> = statement-2 [I joik-jek [statement-2]] ...
*/
statement_1 : statement_2
| statement_1 i_joik_jek statement_2
| statement_1 i_joik_jek
;
i_joik_jek : PRIVATE_I_JEKJOIK I joik_opt_ke free_seq
| PRIVATE_I_JEKJOIK I joik_opt_ke
| PRIVATE_I_JEKJOIK I jek_opt_ke free_seq
| PRIVATE_I_JEKJOIK I jek_opt_ke
;
/*
statement-2<13> = statement-3 [I [jek | joik] [stag] BO # [statement-2]]
*/
statement_2 : statement_3
| statement_3 i_jj_stag_bo
| statement_3 i_jj_stag_bo statement_2
;
i_jj_stag_bo : PRIVATE_I_BO I joik stag BO free_seq
| PRIVATE_I_BO I joik stag BO
| PRIVATE_I_BO I joik BO free_seq
| PRIVATE_I_BO I joik BO
| PRIVATE_I_BO I jek stag BO free_seq
| PRIVATE_I_BO I jek stag BO
| PRIVATE_I_BO I jek BO free_seq
| PRIVATE_I_BO I jek BO
| PRIVATE_I_BO I stag BO free_seq
| PRIVATE_I_BO I stag BO
| PRIVATE_I_BO I BO free_seq
| PRIVATE_I_BO I BO
;
/*
statement-3<14> = sentence | [tag] TUhE # text-1 /TUhU#/
*/
statement_3 : sentence
| tag TUhE free_seq text_1 TUhU free_seq
| tag TUhE free_seq text_1 TUhU
| tag TUhE free_seq text_1 /* ET TUhU */
| tag TUhE text_1 TUhU free_seq
| tag TUhE text_1 TUhU
| tag TUhE text_1 /* ET TUhU */
| TUhE free_seq text_1 TUhU free_seq
| TUhE free_seq text_1 TUhU
| TUhE free_seq text_1 /* ET TUhU */
| TUhE text_1 TUhU free_seq
| TUhE text_1 TUhU
| TUhE text_1 /* ET TUhU */
;
/*
fragment<20> = ek # | gihek # | quantifier | NA # | terms /VAU#/ | prenex |
relative-clauses | links | linkargs
*/
fragment : ek free_seq
| ek
| gihek free_seq
| gihek
| quantifier
| NA free_seq
| NA
| terms VAU free_seq
| terms VAU
| terms /* ET VAU */
| prenex
| relative_clauses
| links
| linkargs
;
/*
prenex<30> = terms ZOhU #
*/
prenex : terms ZOhU free_seq
| terms ZOhU
;
/*
sentence<40> = [terms [CU #]] bridi-tail
*/
/* It would be nice to rearrange this so that CU occurs at the end of a rule,
so that the support for the 'show_elidables' option works the same way as
for all other elidables. Unfortunately, if [terms [CU#]] is broken off as a
rule on its own, a reduce/reduce conflict is introduced between reducing the
terms on its own versus reducing terms on its own in the fragment rule.
Although this can be accommodated with care, there is a worse problem. In a
sentence like "mi pu klama le zarci", the "pu" gets treated as being a term
in the terms before the missing CU, i.e. effectively "mi puku cu klama le
zarci". This is incorrect, it should be reduced as part of the bridi_tail.
This is pretty-much a showstopper problem for proceeding that way, so CU
just has to have special treatment in elide.c. */
sentence : terms CU free_seq bridi_tail
| terms CU bridi_tail
| no_cu_sentence
| observative_sentence
/* The following are all artificial */
| terms PRIVATE_START_GIHEK /* error */
{
fprintf(stderr, "Missing selbri before GIhA at line %d column %d\n",
@2.first_line, @2.first_column);
error_advance(0);
$$ = $1;
YYERROR;
}
| terms PRIVATE_GIHEK_KE /* error */
{
fprintf(stderr, "Missing selbri before GIhA at line %d column %d\n",
@2.first_line, @2.first_column);
error_advance(0);
$$ = $1;
YYERROR;
}
| terms PRIVATE_GIHEK_BO /* error */
{
fprintf(stderr, "Missing selbri before GIhA at line %d column %d\n",
@2.first_line, @2.first_column);
error_advance(0);
$$ = $1;
YYERROR;
}
;
/* The IMPOSSIBLE_TOKEN branch won't ever match. This allows the terms
* bridi_tail branch to be stripped to produce the all-elidables version of the
* grammar, without giving a syntax error on ';' when actions are inserted, or
* not having a match for this rule under sentence */
no_cu_sentence : IMPOSSIBLE_TOKEN
| terms /* ET CU */ bridi_tail
;
/* A misnomer if there is a 'fa' in the tail terms, however ... */
observative_sentence : bridi_tail
;
/*
subsentence<41> = sentence | prenex subsentence
*/
subsentence : sentence
| prenex subsentence
;
/*
bridi-tail<50> = bridi-tail-1
[gihek [stag] KE # bridi-tail /KEhE#/ tail-terms]
*/
bridi_tail : bridi_tail_1
| bridi_tail_1 gihek_stag_ke KE free_seq bridi_tail KEhE free_seq tail_terms
| bridi_tail_1 gihek_stag_ke KE free_seq bridi_tail KEhE free_seq /* ET VAU */
| bridi_tail_1 gihek_stag_ke KE free_seq bridi_tail KEhE tail_terms
| bridi_tail_1 gihek_stag_ke KE free_seq bridi_tail KEhE /* ET VAU */
| bridi_tail_1 gihek_stag_ke KE free_seq bridi_tail /* ET KEhE */ tail_terms
| bridi_tail_1 gihek_stag_ke KE free_seq bridi_tail /* ET KEhE */ /* ET VAU */
| bridi_tail_1 gihek_stag_ke KE bridi_tail KEhE free_seq tail_terms
| bridi_tail_1 gihek_stag_ke KE bridi_tail KEhE free_seq /* ET VAU */
| bridi_tail_1 gihek_stag_ke KE bridi_tail KEhE tail_terms
| bridi_tail_1 gihek_stag_ke KE bridi_tail KEhE /* ET VAU */
| bridi_tail_1 gihek_stag_ke KE bridi_tail /* ET KEhE */ tail_terms
| bridi_tail_1 gihek_stag_ke KE bridi_tail /* ET VAU */
;
gihek_stag_ke : PRIVATE_GIHEK_KE gihek stag
| PRIVATE_GIHEK_KE gihek
;
/*
bridi-tail-1<51> = bridi-tail-2 [gihek # bridi-tail-2 tail-terms] ...
*/
bridi_tail_1 : bridi_tail_2
| bridi_tail_1 gihek free_seq bridi_tail_2 tail_terms
| bridi_tail_1 gihek free_seq bridi_tail_2 /* ET VAU */
| bridi_tail_1 gihek bridi_tail_2 tail_terms
| bridi_tail_1 gihek bridi_tail_2 /* ET VAU */
;
/*
bridi-tail-2<52> = bridi-tail-3 [gihek [stag] BO # bridi-tail-2 tail-terms]
*/
bridi_tail_2 : bridi_tail_3
| bridi_tail_2 gihek_stag_bo bridi_tail_2 tail_terms
| bridi_tail_2 gihek_stag_bo bridi_tail_2 /* ET VAU */
;
gihek_stag_bo : PRIVATE_GIHEK_BO gihek stag BO free_seq
| PRIVATE_GIHEK_BO gihek stag BO
| PRIVATE_GIHEK_BO gihek BO free_seq
| PRIVATE_GIHEK_BO gihek BO
;
/*
bridi-tail-3<53> = selbri tail-terms | gek-sentence
*/
bridi_tail_3 : main_selbri tail_terms
| main_selbri /* ET VAU */
| gek_sentence
;
main_selbri : selbri
;
/* The case of empty tail_terms must be handled in the parent rule and
tagged with [* ET *] because there is a VAU elided in such a case */
tail_terms : terms VAU free_seq
| terms VAU
| terms /* ET VAU */
| VAU free_seq
| VAU
;
/*
gek-sentence<54> = gek subsentence gik subsentence tail-terms |
[tag] KE # gek-sentence /KEhE#/ | NA # gek-sentence
*/
gek_sentence : gek subsentence gik subsentence tail_terms
| gek subsentence gik subsentence /* ET VAU */
| tag KE free_seq gek_sentence KEhE free_seq
| tag KE free_seq gek_sentence KEhE
| tag KE free_seq gek_sentence /* ET KEhE */
| tag KE gek_sentence KEhE free_seq
| tag KE gek_sentence KEhE
| tag KE gek_sentence /* ET KEhE */
| KE free_seq gek_sentence KEhE free_seq
| KE free_seq gek_sentence KEhE
| KE free_seq gek_sentence /* ET KEhE */
| KE gek_sentence KEhE free_seq
| KE gek_sentence KEhE
| KE gek_sentence /* ET KEhE */
| NA free_seq gek_sentence
| NA gek_sentence
;
/*
This can reduce to null, so must be folded into everywhere it appears,
unfortunately */
/*
tail-terms<71> = [terms] /VAU#/
*/
/*
terms<80> = terms-1 ...
*/
terms : terms_1
| terms terms_1
;
/*
terms-1<81> = terms-2 [PEhE # joik-jek terms-2] ...
*/
terms_1 : terms_2
| terms_1 PEhE free_seq joik free_seq terms_2
| terms_1 PEhE free_seq joik terms_2
| terms_1 PEhE free_seq jek free_seq terms_2
| terms_1 PEhE free_seq jek terms_2
| terms_1 PEhE joik free_seq terms_2
| terms_1 PEhE joik terms_2
| terms_1 PEhE jek free_seq terms_2
| terms_1 PEhE jek terms_2
;
/*
terms-2<82> = term [CEhE # term] ...
*/
terms_2 : term
| terms_2 CEhE free_seq term
| terms_2 CEhE term
;
/*
term<83> = sumti | (tag | FA #) (sumti | /KU#/) | termset | NA KU #
*/
/* [ET] needed below to fix up the tag stag gik sumti-4... S/R conflict, which
* is avoided by using tag termset. */
term : term_plain_sumti
| term_tagged_sumti /* ET */
| term_placed_sumti
| term_floating_tense
| termset
| tagged_termset
| term_floating_negate
| term_other
;
term_plain_sumti : sumti
;
term_placed_sumti : FA free_seq sumti
| FA sumti
;
term_tagged_sumti : tag sumti
;
/* The next rule follows an email discussion on onelist/egroups in early June
* 2000, about how to fix the "tag tag gi sumti gi sumti" shift-reduce conflict
* problem. This also accommodates a statement in the Book which is not
* realised in either bnf.233 or bnf.300 */
tagged_termset : tag termset
;
term_floating_tense : tag KU free_seq
| tag KU
| tag /* ET KU */
;
term_floating_negate : PRIVATE_NA_KU NA KU free_seq
| PRIVATE_NA_KU NA KU
;
/* Where on earth do these arise? 'FA' on its own can be in a fragment as an answer to a fa'i question,
but what about the others??? */
term_other : FA free_seq KU free_seq
| FA free_seq KU
| FA free_seq /* ET KU */
| FA KU free_seq
| FA KU
| FA /* ET KU */
;
/*
termset<85> = NUhI # gek terms /NUhU#/ gik terms /NUhU#/ |
NUhI # terms /NUhU#/
*/
/* Termset is broken up this way so that the intermediate /NUhU#/ occurs
at the end of a rule. This makes the support for the
'show_elidables_verbose' option easier to do. */
termset : termset_start gek termset_body gik termset_body
| termset_start termset_body
;
termset_start : NUhI free_seq
| NUhI
;
termset_body : terms NUhU free_seq
| terms NUhU
| terms /* ET NUhU */
;
/*
sumti<90> = sumti-1 [VUhO # relative-clauses]
*/
sumti : sumti_1
| sumti_1 VUhO free_seq relative_clauses
| sumti_1 VUhO relative_clauses
;
/*
sumti-1<91> = sumti-2 [(ek | joik) [stag] KE # sumti /KEhE#/]
*/
sumti_1 : sumti_2
| sumti_2 joik_ek_ke ke_sumti
;
joik_ek_ke : PRIVATE_JOIK_KE joik stag
| PRIVATE_JOIK_KE joik
| PRIVATE_EK_KE ek stag
| PRIVATE_EK_KE ek
;
ke_sumti : KE free_seq sumti KEhE free_seq
| KE free_seq sumti KEhE
| KE free_seq sumti /* ET KEhE */
| KE sumti KEhE free_seq
| KE sumti KEhE
| KE sumti /* ET KEhE */
;
/*
sumti-2<92> = sumti-3 [joik-ek sumti-3] ...
*/
sumti_2 : sumti_3
| sumti_2 joik free_seq sumti_3
| sumti_2 joik sumti_3
| sumti_2 ek free_seq sumti_3
| sumti_2 ek sumti_3
;
/*
sumti-3<93> = sumti-4 [(ek | joik) [stag] BO # sumti-3]
*/
sumti_3 : sumti_4
| sumti_4 joik_ek_stag_bo sumti_3
;
joik_ek_stag_bo : PRIVATE_JOIK_BO joik stag BO free_seq
| PRIVATE_JOIK_BO joik stag BO
| PRIVATE_JOIK_BO joik BO free_seq
| PRIVATE_JOIK_BO joik BO
| PRIVATE_EK_BO ek stag BO free_seq
| PRIVATE_EK_BO ek stag BO
| PRIVATE_EK_BO ek BO free_seq
| PRIVATE_EK_BO ek BO
;
/*
sumti-4<94> = sumti-5 | gek sumti gik sumti-4
*/
sumti_4 : sumti_5
| gek sumti gik sumti_4
;
/*
sumti-5<95> = [quantifier] sumti-6 [relative-clauses] |
quantifier selbri /KU#/ [relative-clauses]
*/
sumti_5 : sumti_5a relative_clauses
| sumti_5a
| sumti_5b relative_clauses
| sumti_5b
;
sumti_5a : quantifier sumti_6
| sumti_6
;
sumti_5b : quantifier selbri KU free_seq
| quantifier selbri KU
| quantifier selbri /* ET KU */
;
/*
sumti-6<97> = (LAhE # | NAhE BO #) [relative-clauses] sumti /LUhU#/ |
KOhA # | lerfu-string /BOI#/ | LA # [relative-clauses] CMENE ... # |
(LA | LE) # sumti-tail /KU#/ | LI # mex /LOhO#/ |
ZO any-word # | LU text /LIhU#/ | LOhU any-word ... LEhU # |
ZOI any-word anything any-word #
*/
sumti_6 : lahe_sumti_6
| nahe_bo_sumti_6
| KOhA free_seq
| KOhA
| lerfu_string BOI free_seq
| lerfu_string BOI
| lerfu_string /* ET BOI */
| LE free_seq sumti_tail KU free_seq
| LE free_seq sumti_tail KU
| LE free_seq sumti_tail /* ET KU */
| LE sumti_tail KU free_seq
| LE sumti_tail KU
| LE sumti_tail /* ET KU */
| LA free_seq sumti_tail KU free_seq
| LA free_seq sumti_tail KU
| LA free_seq sumti_tail /* ET KU */
| LA sumti_tail KU free_seq
| LA sumti_tail KU
| LA sumti_tail /* ET KU */
| name_sumti_6
| LI free_seq mex LOhO free_seq