-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexpr_penskoy.pl
1175 lines (1017 loc) · 51.8 KB
/
expr_penskoy.pl
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
% Rule: rule_operator-gt []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("->",_)),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 2),
fail.
% Rule: rule_before_before []
swrl_rule() :-
before(A, B), before(B, C),
rdf_assert(A, 'http://penskoy.n/expressions#before', C),
fail.
% Rule: rule_operator( []
swrl_rule() :-
text(A, ^^("<(>",_)), step(A, ^^(1,_)), prev_operation(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 0),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "complex"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#complex_beginning', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#is_function_call', "false"^^xsd:boolean),
fail.
% Rule: rule_operator*= []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("*=",_)),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 16),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_operator, []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("<,>",_)),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 17),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#is_operator_with_strict_operands_order', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
fail.
% Rule: rule_operator-= []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("-=",_)),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 16),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_operator. []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^(".",_)),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 2),
fail.
% Rule: rule_operator/ []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("/",_)),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 5),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
fail.
% Rule: rule_operator/= []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("/=",_)),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 16),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_operator: []
swrl_rule() :-
text(A, ^^(":",_)), step(A, ^^(1,_)),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "ternary"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 16),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#complex_ending', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_operatorltlt []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("<<",_)),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 7),
fail.
% Rule: rule_operator:: []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("::",_)),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 1),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
fail.
% Rule: rule_complex_boundaries_empty []
swrl_rule() :-
next_index(A, ^^(B,_)), step(A, ^^(0,_)), complex_beginning(A, true), complex_ending(B, true),
rdf_assert(A, 'http://penskoy.n/expressions#complex_boundaries', B),
fail.
% Rule: rule_operatorlt []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("<",_)),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 9),
fail.
% Rule: rule_operatorltlt= []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("<<=",_)),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 16),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_operatorlt= []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("<=",_)),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 9),
fail.
% Rule: rule_copy_eval_step_to_zero_step []
swrl_rule() :-
eval_step(A, A_STEP), zero_step(A, A0),
rdf_assert(A0, 'http://penskoy.n/expressions#eval_step', A_STEP),
fail.
% Rule: rule_operator= []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("=",_)),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 16),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_operatorgt= []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^(">=",_)),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 9),
fail.
% Rule: rule_copy_app []
swrl_rule() :-
copy(A, TO), app(A, true),
rdf_assert(TO, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
fail.
% Rule: rule_operator== []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("==",_)),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 10),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
fail.
% Rule: rule_copy_eval []
swrl_rule() :-
copy(A, TO), eval(A, true),
rdf_assert(TO, 'http://penskoy.n/expressions#eval', "true"^^xsd:boolean),
fail.
% Rule: rule_operatorgt []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^(">",_)),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 9),
fail.
% Rule: rule_copy_has_complex_operator_part_to_zero_step []
swrl_rule() :-
has_complex_operator_part(A, B), zero_step(A, A0), zero_step(B, B0),
rdf_assert(A0, 'http://penskoy.n/expressions#has_complex_operator_part', B0),
fail.
% Rule: rule_operatorgtgt []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^(">>",_)),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 7),
fail.
% Rule: rule_copy_has_operand_to_zero_step []
swrl_rule() :-
has_operand(A, B), zero_step(A, A0), zero_step(B, B0),
rdf_assert(A0, 'http://penskoy.n/expressions#has_operand', B0),
fail.
% Rule: rule_operatorgtgt= []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^(">>=",_)),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 16),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_copy_to_zero_step []
swrl_rule() :-
step(A, ^^(0,_)), step(B, ^^(1,_)), zero_step(B, A),
rdf_assert(B, 'http://penskoy.n/expressions#copy_without_marks', A),
fail.
% Rule: rule_operator_binary& []
swrl_rule() :-
text(A, ^^("&",_)), step(A, ^^(1,_)), prev_operand(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 11),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
fail.
% Rule: rule_eval_complex_operation_copy_other_right []
swrl_rule() :-
next_step(C, C_NEXT), next_index(B, ^^(C,_)), has_highest_priority_to_right(A, true), next_step(OTHER, OTHER_NEXT), same_step(A, OTHER), complex_boundaries(A, C), index(C, ^^(C_INDEX,_)), all_eval_to_right(A, B), arity(A, "complex"), init(A, true), has_highest_priority_to_left(A, true), not_index(A, ^^(OTHER,_)), next_step(A, A_NEXT), not_index(C, ^^(OTHER,_)), same_step(A, C), index(OTHER, ^^(OTHER_INDEX,_)), index(A, ^^(A_INDEX,_)), greaterThan(OTHER_INDEX, C_INDEX),
rdf_assert(OTHER, 'http://penskoy.n/expressions#copy', OTHER_NEXT),
fail.
% Rule: rule_copy_init []
swrl_rule() :-
copy(A, TO), init(A, true),
rdf_assert(TO, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
fail.
% Rule: rule_operator? []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("?",_)),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "ternary"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 16),
rdf_assert(A, 'http://penskoy.n/expressions#is_operator_with_strict_operands_order', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#complex_beginning', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_copy_to_1_step []
swrl_rule() :-
step(A, ^^(0,_)), step(B, ^^(1,_)), zero_step(B, A),
rdf_assert(A, 'http://penskoy.n/expressions#copy', B),
fail.
% Rule: rule_copy_without_marks []
swrl_rule() :-
copy(A, TO),
rdf_assert(A, 'http://penskoy.n/expressions#copy_without_marks', TO),
fail.
% Rule: rule_operator^ []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("^",_)),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 12),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
fail.
% Rule: rule_copy_without_marks_arity []
swrl_rule() :-
arity(A, A_ARITY), copy_without_marks(A, TO),
rdf_assert(TO, 'http://penskoy.n/expressions#arity', A_ARITY),
fail.
% Rule: rule_copy_without_marks_associativity []
swrl_rule() :-
associativity(A, A_ASSOCIATIVITY), copy_without_marks(A, TO),
rdf_assert(TO, 'http://penskoy.n/expressions#associativity', A_ASSOCIATIVITY),
fail.
% Rule: rule_operator^= []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("^=",_)),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 16),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_copy_without_marks_complex_beginning []
swrl_rule() :-
complex_beginning(A, B), copy_without_marks(A, TO),
rdf_assert(TO, 'http://penskoy.n/expressions#complex_beginning', B),
fail.
% Rule: rule_operator_binary* []
swrl_rule() :-
text(A, ^^("*",_)), step(A, ^^(1,_)), prev_operand(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 5),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
fail.
% Rule: rule_copy_without_marks_complex_boundaries []
swrl_rule() :-
same_step(C, TO), copy_without_marks(A, TO), complex_boundaries(A, B), zero_step(C, B0), zero_step(B, B0),
rdf_assert(TO, 'http://penskoy.n/expressions#complex_boundaries', C),
fail.
% Rule: rule_operator_binary+ []
swrl_rule() :-
text(A, ^^("+",_)), step(A, ^^(1,_)), prev_operand(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 6),
fail.
% Rule: rule_copy_without_marks_complex_ending []
swrl_rule() :-
complex_ending(A, B), copy_without_marks(A, TO),
rdf_assert(TO, 'http://penskoy.n/expressions#complex_ending', B),
fail.
% Rule: rule_operator_binary- []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("-",_)), prev_operand(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 6),
fail.
% Rule: rule_copy_without_marks_in_complex []
swrl_rule() :-
same_step(C, TO), copy_without_marks(A, TO), in_complex(A, B), zero_step(C, B0), zero_step(B, B0),
rdf_assert(TO, 'http://penskoy.n/expressions#in_complex', C),
fail.
% Rule: rule_operator_function_call []
swrl_rule() :-
text(A, ^^("<(>",_)), prev_operand(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "complex"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#is_function_call', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 2),
fail.
% Rule: rule_copy_without_marks_is_function_call []
swrl_rule() :-
is_function_call(A, A_FC), copy_without_marks(A, TO),
rdf_assert(TO, 'http://penskoy.n/expressions#is_function_call', A_FC),
fail.
% Rule: rule_operator_postfix++ []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("++",_)), prev_operand(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "unary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#prefix_postfix', "postfix"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 2),
fail.
% Rule: rule_copy_without_marks_is_operand []
swrl_rule() :-
copy_without_marks(A, TO), is_operand(A, IS_OP),
rdf_assert(TO, 'http://penskoy.n/expressions#is_operand', IS_OP),
fail.
% Rule: rule_operator_postfix-- []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("--",_)), prev_operand(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "unary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#prefix_postfix', "postfix"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 2),
fail.
% Rule: rule_copy_without_marks_is_operator_with_strict_operands_order []
swrl_rule() :-
copy_without_marks(A, TO), is_operator_with_strict_operands_order(A, IS_OP),
rdf_assert(TO, 'http://penskoy.n/expressions#is_operator_with_strict_operands_order', IS_OP),
fail.
% Rule: rule_operator_prefix++ []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("++",_)), prev_operation(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "unary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#prefix_postfix', "prefix"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 3),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_copy_without_marks_last []
swrl_rule() :-
last(A, A_LAST), copy_without_marks(A, TO),
rdf_assert(TO, 'http://penskoy.n/expressions#last', A_LAST),
fail.
% Rule: rule_operator_prefix-- []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("--",_)), prev_operation(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "unary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#prefix_postfix', "prefix"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 3),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_copy_without_marks_prefix_postfix []
swrl_rule() :-
prefix_postfix(A, A_PR), copy_without_marks(A, TO),
rdf_assert(TO, 'http://penskoy.n/expressions#prefix_postfix', A_PR),
fail.
% Rule: rule_operator_subscript []
swrl_rule() :-
text(A, ^^("[",_)), step(A, ^^(1,_)),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "complex"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#complex_beginning', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#is_function_call', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 2),
fail.
% Rule: rule_copy_without_marks_priority []
swrl_rule() :-
precedence(A, ^^(A_PRIORITY,_)), copy_without_marks(A, TO),
rdf_assert(TO, 'http://penskoy.n/expressions#precedence', A_PRIORITY),
fail.
% Rule: rule_operator_unary* []
swrl_rule() :-
text(A, ^^("*",_)), step(A, ^^(1,_)), prev_operation(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "unary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#prefix_postfix', "prefix"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 3),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_copy_without_marks_real_pos []
swrl_rule() :-
real_pos(A, A_RP), copy_without_marks(A, TO),
rdf_assert(TO, 'http://penskoy.n/expressions#real_pos', A_RP),
fail.
% Rule: rule_operator_unary+ []
swrl_rule() :-
text(A, ^^("+",_)), step(A, ^^(1,_)), prev_operation(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "unary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#prefix_postfix', "prefix"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 3),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_copy_without_marks_student_pos []
swrl_rule() :-
copy_without_marks(A, TO), student_pos(A, A_SP),
rdf_assert(TO, 'http://penskoy.n/expressions#student_pos', A_SP),
fail.
% Rule: rule_operator_unary- []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("-",_)), prev_operation(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "unary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#prefix_postfix', "prefix"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 3),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_copy_without_marks_text []
swrl_rule() :-
copy_without_marks(A, TO), text(A, ^^(A_TEXT,_)),
rdf_assert(TO, 'http://penskoy.n/expressions#text', A_TEXT),
fail.
% Rule: rule_prev_operand []
swrl_rule() :-
prev_index(A, ^^(B,_)), text(B, ^^(B_TEXT,_)), is_operand(B, true), step(B, ^^(1,_)),
rdf_assert(A, 'http://penskoy.n/expressions#prev_operand', B),
fail.
% Rule: rule_equal_priority_L_assoc []
swrl_rule() :-
equal(A_PRIOR, B_PRIOR), equal(A_ASSOC, B_ASSOC), index(B, ^^(B_INDEX,_)), precedence(A, ^^(A_PRIOR,_)), associativity(B, B_ASSOC), precedence(B, ^^(B_PRIOR,_)), associativity(A, A_ASSOC), equal(A_ASSOC, "L"), index(A, ^^(A_INDEX,_)), lessThan(A_INDEX, B_INDEX), same_step(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#high_priority_left_assoc', B),
rdf_assert(A, 'http://penskoy.n/expressions#high_priority', B),
fail.
% Rule: rule_equal_priority_R_assoc []
swrl_rule() :-
equal(A_PRIOR, B_PRIOR), equal(A_ASSOC, B_ASSOC), index(B, ^^(B_INDEX,_)), precedence(A, ^^(A_PRIOR,_)), associativity(B, B_ASSOC), precedence(B, ^^(B_PRIOR,_)), associativity(A, A_ASSOC), equal(A_ASSOC, "R"), index(A, ^^(A_INDEX,_)), same_step(A, B), greaterThan(A_INDEX, B_INDEX),
rdf_assert(A, 'http://penskoy.n/expressions#high_priority', B),
rdf_assert(A, 'http://penskoy.n/expressions#high_priority_right_assoc', B),
fail.
% Rule: rule_operator| []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("|",_)),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 13),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
fail.
% Rule: rule_eval_,_in_function_call []
swrl_rule() :-
text(A, ^^("<,>",_)), init(A, true), in_complex(A, B), is_function_call(B, true),
rdf_assert(A, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
fail.
% Rule: rule_eval_binary_operation []
swrl_rule() :-
next_step(B, B_NEXT), next_step(C, C_NEXT), has_highest_priority_to_right(A, true), find_left_operand(A, B), step(A, ^^(A_STEP,_)), arity(A, "binary"), init(A, true), has_highest_priority_to_left(A, true), find_right_operand(A, C), next_step(A, A_NEXT), same_step(A, C), same_step(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#has_operand', C),
rdf_assert(A, 'http://penskoy.n/expressions#copy_without_marks', A_NEXT),
rdf_assert(C, 'http://penskoy.n/expressions#copy_without_marks', C_NEXT),
rdf_assert(B_NEXT, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#eval_step', A_STEP),
rdf_assert(C_NEXT, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
rdf_assert(A_NEXT, 'http://penskoy.n/expressions#eval', "true"^^xsd:boolean),
rdf_assert(B, 'http://penskoy.n/expressions#copy_without_marks', B_NEXT),
rdf_assert(A, 'http://penskoy.n/expressions#has_operand', B),
fail.
% Rule: rule_operator|= []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("|=",_)),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 16),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_eval_binary_operation_copy_other []
swrl_rule() :-
has_highest_priority_to_right(A, true), arity(A, "binary"), next_step(OTHER, OTHER_NEXT), same_step(A, OTHER), find_right_operand(A, C), find_left_operand(A, B), init(A, true), not_index(B, ^^(OTHER,_)), has_highest_priority_to_left(A, true), not_index(A, ^^(OTHER,_)), not_index(C, ^^(OTHER,_)), same_step(A, C), same_step(A, B),
rdf_assert(OTHER, 'http://penskoy.n/expressions#copy', OTHER_NEXT),
fail.
% Rule: rule_eval_complex_operation []
swrl_rule() :-
next_step(C, C_NEXT), next_index(B, ^^(C,_)), has_highest_priority_to_right(A, true), all_eval_to_right(A, B), step(A, ^^(A_STEP,_)), arity(A, "complex"), init(A, true), has_highest_priority_to_left(A, true), next_step(A, A_NEXT), same_step(A, C), complex_boundaries(A, C),
rdf_assert(A, 'http://penskoy.n/expressions#copy_without_marks', A_NEXT),
rdf_assert(C, 'http://penskoy.n/expressions#copy_without_marks', C_NEXT),
rdf_assert(A, 'http://penskoy.n/expressions#eval_step', A_STEP),
rdf_assert(A, 'http://penskoy.n/expressions#has_complex_operator_part', C),
rdf_assert(C_NEXT, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
rdf_assert(A_NEXT, 'http://penskoy.n/expressions#eval', "true"^^xsd:boolean),
fail.
% Rule: rule_operator|| []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("||",_)),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 15),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#is_operator_with_strict_operands_order', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
fail.
% Rule: rule_eval_complex_operation_copy_inner_app []
swrl_rule() :-
next_index(B, ^^(C,_)), has_highest_priority_to_right(A, true), next_step(OTHER, OTHER_NEXT), same_step(A, OTHER), complex_boundaries(A, C), index(C, ^^(C_INDEX,_)), all_eval_to_right(A, B), arity(A, "complex"), app(OTHER, true), init(A, true), has_highest_priority_to_left(A, true), not_index(A, ^^(OTHER,_)), not_index(C, ^^(OTHER,_)), index(OTHER, ^^(OTHER_INDEX,_)), lessThan(OTHER_INDEX, C_INDEX), same_step(A, C), index(A, ^^(A_INDEX,_)), lessThan(A_INDEX, OTHER_INDEX),
rdf_assert(OTHER, 'http://penskoy.n/expressions#copy_without_marks', OTHER_NEXT),
rdf_assert(OTHER_NEXT, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
fail.
% Rule: rule_prev_operation []
swrl_rule() :-
prev_index(A, ^^(B,_)), arity(B, B_ARITY), notEqual(B_ARITY, "unary"), step(B, ^^(1,_)),
rdf_assert(A, 'http://penskoy.n/expressions#prev_operation', B),
fail.
% Rule: rule_eval_complex_operation_copy_inner_eval []
swrl_rule() :-
next_index(B, ^^(C,_)), has_highest_priority_to_right(A, true), next_step(OTHER, OTHER_NEXT), same_step(A, OTHER), complex_boundaries(A, C), index(C, ^^(C_INDEX,_)), all_eval_to_right(A, B), arity(A, "complex"), init(A, true), has_highest_priority_to_left(A, true), not_index(A, ^^(OTHER,_)), not_index(C, ^^(OTHER,_)), index(OTHER, ^^(OTHER_INDEX,_)), lessThan(OTHER_INDEX, C_INDEX), same_step(A, C), index(A, ^^(A_INDEX,_)), lessThan(A_INDEX, OTHER_INDEX), eval(OTHER, true),
rdf_assert(OTHER, 'http://penskoy.n/expressions#copy_without_marks', OTHER_NEXT),
rdf_assert(OTHER_NEXT, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#has_operand', OTHER),
fail.
% Rule: rule_operator~ []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("~",_)),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "unary"),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#prefix_postfix', "prefix"),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 3),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "R"),
fail.
% Rule: rule_eval_complex_operation_copy_other_left []
swrl_rule() :-
next_step(C, C_NEXT), next_index(B, ^^(C,_)), has_highest_priority_to_right(A, true), next_step(OTHER, OTHER_NEXT), same_step(A, OTHER), complex_boundaries(A, C), index(C, ^^(C_INDEX,_)), all_eval_to_right(A, B), arity(A, "complex"), init(A, true), has_highest_priority_to_left(A, true), not_index(A, ^^(OTHER,_)), next_step(A, A_NEXT), not_index(C, ^^(OTHER,_)), is_function_call(A, false), same_step(A, C), index(OTHER, ^^(OTHER_INDEX,_)), index(A, ^^(A_INDEX,_)), lessThan(OTHER_INDEX, A_INDEX),
rdf_assert(OTHER, 'http://penskoy.n/expressions#copy', OTHER_NEXT),
fail.
% Rule: rule_prev_operand_unary_postfix []
swrl_rule() :-
prev_index(A, ^^(B,_)), arity(B, "unary"), prefix_postfix(B, "postfix"), step(B, ^^(1,_)),
rdf_assert(A, 'http://penskoy.n/expressions#prev_operand', B),
fail.
% Rule: rule_eval_complex_operation_copy_others_left_no_function_name []
swrl_rule() :-
next_step(C, C_NEXT), next_index(B, ^^(C,_)), has_highest_priority_to_right(A, true), next_step(OTHER, OTHER_NEXT), same_step(A, OTHER), complex_boundaries(A, C), index(C, ^^(C_INDEX,_)), find_left_operand(A, D), all_eval_to_right(A, B), arity(A, "complex"), init(A, true), has_highest_priority_to_left(A, true), not_index(A, ^^(OTHER,_)), next_step(A, A_NEXT), is_function_call(A, true), not_index(D, ^^(OTHER,_)), not_index(C, ^^(OTHER,_)), same_step(A, C), index(OTHER, ^^(OTHER_INDEX,_)), index(A, ^^(A_INDEX,_)), lessThan(OTHER_INDEX, A_INDEX),
rdf_assert(OTHER, 'http://penskoy.n/expressions#copy', OTHER_NEXT),
fail.
% Rule: rule_prev_operation_beggining []
swrl_rule() :-
step(A, ^^(1,_)), index(A, ^^(1,_)),
rdf_assert(A, 'http://penskoy.n/expressions#prev_operation', A),
fail.
% Rule: rule_all_eval_to_right []
swrl_rule() :-
all_eval_to_right(A, B), next_index(B, ^^(C,_)), eval(C, true),
rdf_assert(A, 'http://penskoy.n/expressions#all_eval_to_right', C),
fail.
% Rule: rule_eval_function_name []
swrl_rule() :-
next_step(FUNCTION_NAME, FUNCTION_NAME_NEXT), next_index(B, ^^(C,_)), has_highest_priority_to_right(A, true), all_eval_to_right(A, B), find_left_operand(A, FUNCTION_NAME), same_step(A, FUNCTION_NAME), arity(A, "complex"), init(A, true), has_highest_priority_to_left(A, true), is_function_call(A, true), same_step(A, C), complex_boundaries(A, C),
rdf_assert(FUNCTION_NAME, 'http://penskoy.n/expressions#copy_without_marks', FUNCTION_NAME_NEXT),
rdf_assert(FUNCTION_NAME_NEXT, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#has_complex_operator_part', FUNCTION_NAME),
fail.
% Rule: rule_prev_operation_unary_prefix []
swrl_rule() :-
prev_index(A, ^^(B,_)), arity(B, "unary"), prefix_postfix(B, "prefix"), step(B, ^^(1,_)),
rdf_assert(A, 'http://penskoy.n/expressions#prev_operation', B),
fail.
% Rule: rule_eval_operand_in_complex []
swrl_rule() :-
init(A, true), in_complex(A, B), is_operand(A, true),
rdf_assert(A, 'http://penskoy.n/expressions#eval', "true"^^xsd:boolean),
fail.
% Rule: rule_eval_postfix_operation []
swrl_rule() :-
next_step(B, B_NEXT), has_highest_priority_to_right(A, true), find_left_operand(A, B), step(A, ^^(A_STEP,_)), arity(A, "unary"), init(A, true), has_highest_priority_to_left(A, true), prefix_postfix(A, "postfix"), next_step(A, A_NEXT), same_step(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#copy_without_marks', A_NEXT),
rdf_assert(B_NEXT, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#eval_step', A_STEP),
rdf_assert(A_NEXT, 'http://penskoy.n/expressions#eval', "true"^^xsd:boolean),
rdf_assert(B, 'http://penskoy.n/expressions#copy_without_marks', B_NEXT),
rdf_assert(A, 'http://penskoy.n/expressions#has_operand', B),
fail.
% Rule: rule_eval_postfix_operation_copy_others []
swrl_rule() :-
has_highest_priority_to_right(A, true), find_left_operand(A, B), arity(A, "unary"), init(A, true), not_index(B, ^^(OTHER,_)), next_step(OTHER, OTHER_NEXT), same_step(A, OTHER), has_highest_priority_to_left(A, true), not_index(A, ^^(OTHER,_)), prefix_postfix(A, "postfix"), same_step(A, B),
rdf_assert(OTHER, 'http://penskoy.n/expressions#copy', OTHER_NEXT),
fail.
% Rule: rule_same_step []
swrl_rule() :-
step(A, ^^(A_STEP,_)), step(B, ^^(A_STEP,_)),
rdf_assert(A, 'http://penskoy.n/expressions#same_step', B),
fail.
% Rule: rule_eval_prefix_operation []
swrl_rule() :-
next_step(B, B_NEXT), has_highest_priority_to_right(A, true), step(A, ^^(A_STEP,_)), arity(A, "unary"), init(A, true), not_index(B, ^^(OTHER,_)), prefix_postfix(A, "prefix"), has_highest_priority_to_left(A, true), next_step(A, A_NEXT), find_right_operand(A, B), same_step(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#copy_without_marks', A_NEXT),
rdf_assert(B_NEXT, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#eval_step', A_STEP),
rdf_assert(A_NEXT, 'http://penskoy.n/expressions#eval', "true"^^xsd:boolean),
rdf_assert(B, 'http://penskoy.n/expressions#copy_without_marks', B_NEXT),
rdf_assert(A, 'http://penskoy.n/expressions#has_operand', B),
fail.
% Rule: rule_eval_prefix_operation_copy_others []
swrl_rule() :-
has_highest_priority_to_right(A, true), arity(A, "unary"), init(A, true), not_index(B, ^^(OTHER,_)), next_step(OTHER, OTHER_NEXT), prefix_postfix(A, "prefix"), same_step(A, OTHER), has_highest_priority_to_left(A, true), not_index(A, ^^(OTHER,_)), find_right_operand(A, B), same_step(A, B),
rdf_assert(OTHER, 'http://penskoy.n/expressions#copy', OTHER_NEXT),
fail.
% Rule: rule_eval_ternary_operation []
swrl_rule() :-
arity(A, "ternary"), next_step(C, C_NEXT), next_index(B, ^^(C,_)), step(A, ^^(A_STEP,_)), has_highest_priority_to_right(C, true), find_right_operand(C, E), complex_boundaries(A, C), find_left_operand(A, D), all_eval_to_right(A, B), next_step(E, E_NEXT), init(A, true), next_step(D, D_NEXT), next_step(A, A_NEXT), has_highest_priority_to_left(C, true), same_step(A, C),
rdf_assert(A, 'http://penskoy.n/expressions#has_operand', E),
rdf_assert(D, 'http://penskoy.n/expressions#copy_without_marks', D_NEXT),
rdf_assert(A, 'http://penskoy.n/expressions#has_operand', D),
rdf_assert(A, 'http://penskoy.n/expressions#copy_without_marks', A_NEXT),
rdf_assert(C, 'http://penskoy.n/expressions#copy_without_marks', C_NEXT),
rdf_assert(E, 'http://penskoy.n/expressions#copy_without_marks', E_NEXT),
rdf_assert(A, 'http://penskoy.n/expressions#eval_step', A_STEP),
rdf_assert(A, 'http://penskoy.n/expressions#has_complex_operator_part', C),
rdf_assert(C_NEXT, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
rdf_assert(D_NEXT, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
rdf_assert(E_NEXT, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
rdf_assert(A_NEXT, 'http://penskoy.n/expressions#eval', "true"^^xsd:boolean),
fail.
% Rule: rule_eval_ternary_operation_copy_inner_app []
swrl_rule() :-
index(C, ^^(C_INDEX,_)), arity(A, "ternary"), step(A, ^^(A_STEP,_)), step(OTHER, ^^(A_STEP,_)), eval_step(A, A_STEP), app(OTHER, true), next_step(OTHER, OTHER_NEXT), index(OTHER, ^^(OTHER_INDEX,_)), lessThan(OTHER_INDEX, C_INDEX), complex_boundaries(A, C), index(A, ^^(A_INDEX,_)), lessThan(A_INDEX, OTHER_INDEX),
rdf_assert(OTHER, 'http://penskoy.n/expressions#copy_without_marks', OTHER_NEXT),
rdf_assert(OTHER_NEXT, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
fail.
% Rule: rule_eval_ternary_operation_copy_inner_eval []
swrl_rule() :-
index(C, ^^(C_INDEX,_)), arity(A, "ternary"), step(A, ^^(A_STEP,_)), step(OTHER, ^^(A_STEP,_)), eval_step(A, A_STEP), next_step(OTHER, OTHER_NEXT), index(OTHER, ^^(OTHER_INDEX,_)), lessThan(OTHER_INDEX, C_INDEX), complex_boundaries(A, C), index(A, ^^(A_INDEX,_)), lessThan(A_INDEX, OTHER_INDEX), eval(OTHER, true),
rdf_assert(OTHER, 'http://penskoy.n/expressions#copy_without_marks', OTHER_NEXT),
rdf_assert(OTHER_NEXT, 'http://penskoy.n/expressions#app', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#has_operand', OTHER),
fail.
% Rule: rule_eval_ternary_operation_copy_other_left []
swrl_rule() :-
arity(A, "ternary"), eval_step(A, A_STEP), step(A, ^^(A_STEP,_)), next_step(OTHER, OTHER_NEXT), same_step(A, OTHER), find_left_operand(A, D), not_index(D, ^^(OTHER,_)), index(OTHER, ^^(OTHER_INDEX,_)), index(A, ^^(A_INDEX,_)), lessThan(OTHER_INDEX, A_INDEX),
rdf_assert(OTHER, 'http://penskoy.n/expressions#copy', OTHER_NEXT),
fail.
% Rule: rule_before_strict_order_operands []
swrl_rule() :-
is_operator_with_strict_operands_order(A, true), text(A, ^^(A_TEXT,_)), notEqual(A_TEXT, "?"), has_operand(A, B), has_operand(A, C), index(B, ^^(B_INDEX,_)), index(C, ^^(C_INDEX,_)), lessThan(B_INDEX, C_INDEX),
rdf_assert(B, 'http://penskoy.n/expressions#before_direct', C),
rdf_assert(B, 'http://penskoy.n/expressions#before_all_operands', C),
rdf_assert(B, 'http://penskoy.n/expressions#before_by_third_operator', C),
rdf_assert(B, 'http://penskoy.n/expressions#before_third_operator', A),
fail.
% Rule: rule_eval_ternary_operation_copy_other_right []
swrl_rule() :-
arity(A, "ternary"), eval_step(A, A_STEP), step(A, ^^(A_STEP,_)), next_step(OTHER, OTHER_NEXT), same_step(A, OTHER), complex_boundaries(A, C), find_right_operand(C, D), not_index(D, ^^(OTHER,_)), index(OTHER, ^^(OTHER_INDEX,_)), index(C, ^^(C_INDEX,_)), lessThan(C_INDEX, OTHER_INDEX),
rdf_assert(OTHER, 'http://penskoy.n/expressions#copy', OTHER_NEXT),
fail.
% Rule: rule_find_left_operand_eval []
swrl_rule() :-
has_highest_priority_to_right(A, true), prev_index(B, ^^(C,_)), eval(C, true), has_highest_priority_to_left(A, true), all_app_to_left(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#find_left_operand', C),
fail.
% Rule: rule_all_eval_to_right_begin []
swrl_rule() :-
has_highest_priority_to_right(A, true), init(A, true), complex_beginning(A, true), has_highest_priority_to_left(A, true),
rdf_assert(A, 'http://penskoy.n/expressions#all_eval_to_right', A),
fail.
% Rule: rule_find_left_operand_init []
swrl_rule() :-
has_highest_priority_to_right(A, true), prev_index(B, ^^(C,_)), has_highest_priority_to_left(A, true), init(C, true), all_app_to_left(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#find_left_operand', C),
fail.
% Rule: rule_find_right_operand_eval []
swrl_rule() :-
has_highest_priority_to_right(A, true), next_index(B, ^^(C,_)), all_app_to_right(A, B), eval(C, true), has_highest_priority_to_left(A, true),
rdf_assert(A, 'http://penskoy.n/expressions#find_right_operand', C),
fail.
% Rule: rule_find_right_operand_init []
swrl_rule() :-
has_highest_priority_to_right(A, true), next_index(B, ^^(C,_)), all_app_to_right(A, B), has_highest_priority_to_left(A, true), init(C, true),
rdf_assert(A, 'http://penskoy.n/expressions#find_right_operand', C),
fail.
% Rule: rule_has_highest_priority_to_left []
swrl_rule() :-
more_priority_left_by_step(A, B), index(B, ^^(1,_)),
rdf_assert(A, 'http://penskoy.n/expressions#has_highest_priority_to_left', "true"^^xsd:boolean),
fail.
% Rule: rule_has_highest_priority_to_left_in_complex_, []
swrl_rule() :-
prev_index(B, ^^(C,_)), in_complex(A, C), text(A, ^^("<,>",_)), is_function_call(C, false), more_priority_left_by_step(A, B), has_highest_priority_to_left(C, true), complex_boundaries(C, D),
rdf_assert(A, 'http://penskoy.n/expressions#has_highest_priority_to_left', "true"^^xsd:boolean),
fail.
% Rule: rule_has_highest_priority_to_left_in_complex_not_, []
swrl_rule() :-
text(A, ^^(A_TEXT,_)), notEqual(A_TEXT, "<,>"), prev_index(B, ^^(C,_)), in_complex(A, C), more_priority_left_by_step(A, B), has_highest_priority_to_left(C, true),
rdf_assert(A, 'http://penskoy.n/expressions#has_highest_priority_to_left', "true"^^xsd:boolean),
fail.
% Rule: rule_has_highest_priority_to_left_ternary []
swrl_rule() :-
has_highest_priority_to_left(C, true), complex_boundaries(C, D),
rdf_assert(D, 'http://penskoy.n/expressions#has_highest_priority_to_left', "true"^^xsd:boolean),
fail.
% Rule: rule_has_highest_priority_to_right []
swrl_rule() :-
more_priority_right_by_step(A, B), last(B, true),
rdf_assert(A, 'http://penskoy.n/expressions#has_highest_priority_to_right', "true"^^xsd:boolean),
fail.
% Rule: rule_has_highest_priority_to_right_in_complex []
swrl_rule() :-
next_index(B, ^^(D,_)), has_highest_priority_to_right(C, true), in_complex(A, C), more_priority_right_by_step(A, B), complex_boundaries(C, D),
rdf_assert(A, 'http://penskoy.n/expressions#has_highest_priority_to_right', "true"^^xsd:boolean),
fail.
% Rule: rule_operator&& []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("&&",_)),
rdf_assert(A, 'http://penskoy.n/expressions#associativity', "L"),
rdf_assert(A, 'http://penskoy.n/expressions#arity', "binary"),
rdf_assert(A, 'http://penskoy.n/expressions#is_operator_with_strict_operands_order', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#precedence', 14),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
fail.
% Rule: rule_has_highest_priority_to_right_ternary []
swrl_rule() :-
has_highest_priority_to_right(D, true), complex_boundaries(C, D),
rdf_assert(C, 'http://penskoy.n/expressions#has_highest_priority_to_right', "true"^^xsd:boolean),
fail.
% Rule: rule_high_priority []
swrl_rule() :-
precedence(A, ^^(A_PRIOR,_)), precedence(B, ^^(B_PRIOR,_)), lessThan(A_PRIOR, B_PRIOR), same_step(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#high_priority', B),
rdf_assert(A, 'http://penskoy.n/expressions#high_priority_diff_priority', B),
fail.
% Rule: rule_in_complex_begin []
swrl_rule() :-
next_index(A, ^^(B,_)), complex_beginning(A, true), complex_ending(B, false), step(A, ^^(0,_)),
rdf_assert(B, 'http://penskoy.n/expressions#in_complex', A),
fail.
% Rule: rule_describe_error []
swrl_rule() :-
student_pos_less(B, A), before_direct(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#describe_error', B),
fail.
% Rule: rule_in_complex_step []
swrl_rule() :-
next_index(A, ^^(B,_)), step(A, ^^(0,_)), complex_beginning(A, false), in_complex(A, C), complex_ending(B, false),
rdf_assert(B, 'http://penskoy.n/expressions#in_complex', C),
fail.
% Rule: rule_student_error_in_complex []
swrl_rule() :-
before_by_third_operator(A, B), before_third_operator(A, C), text(C, ^^("<(>",_)), describe_error(A, B),
rdf_assert(B, 'http://penskoy.n/expressions#student_error_in_complex', A),
fail.
% Rule: rule_in_complex_step_skip_inner_complex []
swrl_rule() :-
in_complex(A, C), complex_boundaries(A, D), step(A, ^^(0,_)),
rdf_assert(D, 'http://penskoy.n/expressions#in_complex', C),
fail.
% Rule: rule_student_error_in_complex_bound []
swrl_rule() :-
before_as_operand(A, B), complex_beginning(B, true), describe_error(A, B),
rdf_assert(B, 'http://penskoy.n/expressions#student_error_in_complex', A),
fail.
% Rule: rule_is_operand_close_bracket []
swrl_rule() :-
step(A, ^^(1,_)), text(A, ^^("]",_)),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#is_operand', "true"^^xsd:boolean),
fail.
% Rule: rule_student_error_left_assoc []
swrl_rule() :-
before_as_operand(A, B), describe_error(A, B), high_priority_left_assoc(A, B),
rdf_assert(B, 'http://penskoy.n/expressions#student_error_left_assoc', A),
fail.
% Rule: rule_all_app_to_right_begin []
swrl_rule() :-
has_highest_priority_to_right(A, true), init(A, true),
rdf_assert(A, 'http://penskoy.n/expressions#all_app_to_right', A),
fail.
% Rule: rule_student_error_more_priority []
swrl_rule() :-
before_as_operand(A, B), describe_error(A, B), high_priority_diff_priority(A, B),
rdf_assert(B, 'http://penskoy.n/expressions#student_error_more_priority', A),
fail.
% Rule: rule_is_operand []
swrl_rule() :-
text(A, ^^(A_TEXT,_)), notEqual(A_TEXT, "sizeof"), matches(A_TEXT, "[a-zA-Z_0-9]+"), step(A, ^^(1,_)),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#is_operand', "true"^^xsd:boolean),
fail.
% Rule: rule_student_error_right_assoc []
swrl_rule() :-
before_as_operand(A, B), describe_error(A, B), high_priority_right_assoc(A, B),
rdf_assert(B, 'http://penskoy.n/expressions#student_error_right_assoc', A),
fail.
% Rule: rule_is_operand_close_parenthesis []
swrl_rule() :-
text(A, ^^(")",_)), step(A, ^^(1,_)),
rdf_assert(A, 'http://penskoy.n/expressions#init', "true"^^xsd:boolean),
rdf_assert(A, 'http://penskoy.n/expressions#is_operand', "true"^^xsd:boolean),
fail.
% Rule: rule_student_error_strict_operands_order []
swrl_rule() :-
before_by_third_operator(A, B), before_third_operator(A, C), is_operator_with_strict_operands_order(C, true), describe_error(A, B),
rdf_assert(B, 'http://penskoy.n/expressions#student_error_strict_operands_order', A),
fail.
% Rule: rule_more_priority_left_by_step []
swrl_rule() :-
more_priority_left_by_step(A, B), prev_index(B, ^^(C,_)), high_priority(A, C),
rdf_assert(A, 'http://penskoy.n/expressions#more_priority_left_by_step', C),
fail.
% Rule: rule_more_priority_left_by_step_app []
swrl_rule() :-
more_priority_left_by_step(A, B), prev_index(B, ^^(C,_)), app(C, true),
rdf_assert(A, 'http://penskoy.n/expressions#more_priority_left_by_step', C),
fail.
% Rule: rule_more_priority_left_by_step_eval []
swrl_rule() :-
more_priority_left_by_step(A, B), prev_index(B, ^^(C,_)), eval(C, true),
rdf_assert(A, 'http://penskoy.n/expressions#more_priority_left_by_step', C),
fail.
% Rule: rule_more_priority_left_by_step_first []
swrl_rule() :-
precedence(A, ^^(A_PRIOR,_)), init(A, true),
rdf_assert(A, 'http://penskoy.n/expressions#more_priority_left_by_step', A),
fail.
% Rule: rule_more_priority_left_by_step_operand []
swrl_rule() :-
more_priority_left_by_step(A, B), prev_index(B, ^^(C,_)), is_operand(C, true),
rdf_assert(A, 'http://penskoy.n/expressions#more_priority_left_by_step', C),
fail.
% Rule: rule_ast_edge_has_complex_operator_part []
swrl_rule() :-
has_complex_operator_part(A, B),
rdf_assert(A, 'http://penskoy.n/expressions#ast_edge', B),
fail.
% Rule: rule_more_priority_right_by_step []
swrl_rule() :-
more_priority_right_by_step(A, B), next_index(B, ^^(C,_)), high_priority(A, C),
rdf_assert(A, 'http://penskoy.n/expressions#more_priority_right_by_step', C),
fail.
% Rule: rule_more_priority_right_by_step_app []
swrl_rule() :-
more_priority_right_by_step(A, B), next_index(B, ^^(C,_)), app(C, true),
rdf_assert(A, 'http://penskoy.n/expressions#more_priority_right_by_step', C),
fail.
% Rule: rule_more_priority_right_by_step_eval []
swrl_rule() :-
more_priority_right_by_step(A, B), next_index(B, ^^(C,_)), eval(C, true),
rdf_assert(A, 'http://penskoy.n/expressions#more_priority_right_by_step', C),
fail.
% Rule: rule_more_priority_right_by_step_first []
swrl_rule() :-
precedence(A, ^^(A_PRIOR,_)), init(A, true),
rdf_assert(A, 'http://penskoy.n/expressions#more_priority_right_by_step', A),
fail.
% Rule: rule_more_priority_right_by_step_operand []
swrl_rule() :-