• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

programming language


Commit MetaInfo

Revisão74a140e2018ca068a11329dd526978fa592a9cef (tree)
Hora2023-04-05 21:29:08
Autordhrname <dhrname@joes...>
Commiterdhrname

Mensagem de Log

Modify the lexer

Mudança Sumário

Diff

Binary files a/bin/obj/lex.o and b/bin/obj/lex.o differ
Binary files a/bin/obj/main.o and b/bin/obj/main.o differ
--- a/lex.l
+++ b/lex.l
@@ -203,7 +203,7 @@ DIGIT [1-9][0-9]*
203203 "const" return jstr::parser::terminal::CONST ;
204204 "volatile" return jstr::parser::terminal::VOLATILE ;
205205
206-"class" return jstr::parser::terminal::CLASS ;
206+"cla" return jstr::parser::terminal::CLASS ;
207207 "new" return jstr::parser::terminal::NEW ;
208208 "this" return jstr::parser::terminal::THIS ;
209209 "delete" return jstr::parser::terminal::DELETE ;
--- a/lex.yy.cc
+++ b/lex.yy.cc
@@ -394,7 +394,7 @@ struct yy_trans_info
394394 flex_int32_t yy_verify;
395395 flex_int32_t yy_nxt;
396396 };
397-static const flex_int16_t yy_accept[221] =
397+static const flex_int16_t yy_accept[219] =
398398 { 0,
399399 0, 0, 96, 95, 93, 93, 79, 95, 95, 78,
400400 95, 83, 84, 76, 74, 35, 75, 82, 77, 95,
@@ -410,16 +410,16 @@ static const flex_int16_t yy_accept[221] =
410410 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
411411 88, 88, 88, 88, 88, 64, 94, 94, 91, 34,
412412 0, 62, 63, 15, 88, 9, 10, 11, 12, 88,
413- 88, 88, 29, 88, 88, 88, 33, 28, 14, 88,
413+ 88, 22, 29, 88, 88, 88, 33, 28, 14, 88,
414414 88, 88, 88, 88, 13, 42, 1, 2, 3, 4,
415415 88, 17, 88, 88, 23, 16, 88, 88, 88, 88,
416416 5, 6, 7, 8, 18, 88, 88, 0, 88, 31,
417- 26, 88, 88, 88, 88, 88, 45, 44, 88, 88,
418- 88, 88, 55, 88, 88, 88, 24, 27, 88, 88,
419- 90, 47, 22, 20, 88, 88, 88, 49, 88, 88,
417+ 26, 88, 88, 88, 88, 45, 44, 88, 88, 88,
418+ 88, 55, 88, 88, 88, 24, 27, 88, 88, 90,
419+ 47, 20, 88, 88, 88, 49, 88, 88, 88, 48,
420420
421- 88, 48, 50, 88, 88, 40, 90, 88, 25, 32,
422- 87, 86, 54, 30, 88, 88, 88, 46, 21, 0
421+ 50, 88, 88, 40, 90, 88, 25, 32, 87, 86,
422+ 54, 30, 88, 88, 88, 46, 21, 0
423423 } ;
424424
425425 static const YY_CHAR yy_ec[256] =
@@ -464,65 +464,65 @@ static const YY_CHAR yy_meta[60] =
464464 5, 5, 5, 5, 5, 5, 1, 1, 1
465465 } ;
466466
467-static const flex_int16_t yy_base[227] =
467+static const flex_int16_t yy_base[225] =
468468 { 0,
469- 0, 58, 288, 289, 289, 284, 257, 279, 281, 254,
470- 273, 289, 289, 45, 49, 289, 48, 265, 251, 263,
471- 262, 289, 289, 37, 248, 38, 289, 0, 22, 62,
472- 32, 38, 28, 71, 242, 50, 237, 239, 224, 234,
473- 48, 81, 224, 230, 289, 211, 289, 92, 101, 289,
474- 289, 289, 262, 261, 263, 289, 289, 289, 289, 289,
475- 289, 289, 289, 289, 249, 75, 289, 101, 248, 247,
476- 233, 289, 289, 289, 232, 0, 216, 221, 233, 233,
477- 236, 233, 67, 220, 90, 84, 211, 85, 88, 203,
478- 95, 204, 201, 224, 224, 227, 224, 0, 197, 0,
479-
480- 199, 202, 196, 187, 198, 198, 188, 196, 188, 210,
481- 210, 213, 210, 71, 190, 289, 138, 139, 140, 289,
482- 119, 289, 289, 0, 196, 0, 0, 0, 0, 185,
483- 190, 177, 0, 97, 188, 191, 0, 0, 0, 185,
484- 185, 175, 183, 182, 0, 0, 0, 0, 0, 0,
485- 172, 0, 172, 183, 0, 0, 170, 163, 164, 175,
486- 0, 0, 0, 0, 0, 178, 167, 130, 167, 0,
487- 0, 159, 157, 166, 155, 169, 0, 0, 155, 155,
488- 166, 152, 0, 163, 148, 153, 0, 0, 146, 158,
489- 138, 0, 0, 0, 149, 156, 153, 0, 141, 140,
490-
491- 139, 0, 0, 135, 98, 0, 146, 81, 0, 0,
492- 0, 0, 0, 0, 70, 63, 38, 0, 0, 289,
493- 171, 176, 179, 181, 183, 184
469+ 0, 58, 286, 287, 287, 282, 255, 277, 279, 252,
470+ 271, 287, 287, 45, 49, 287, 48, 263, 249, 261,
471+ 260, 287, 287, 37, 246, 38, 287, 0, 22, 62,
472+ 32, 38, 28, 71, 240, 50, 235, 237, 222, 232,
473+ 48, 81, 222, 228, 287, 209, 287, 92, 101, 287,
474+ 287, 287, 260, 259, 261, 287, 287, 287, 287, 287,
475+ 287, 287, 287, 287, 247, 75, 287, 101, 246, 245,
476+ 231, 287, 287, 287, 230, 0, 214, 219, 231, 231,
477+ 234, 231, 67, 218, 90, 84, 209, 85, 88, 201,
478+ 95, 202, 199, 222, 222, 225, 222, 0, 195, 0,
479+
480+ 197, 200, 194, 185, 196, 196, 186, 194, 186, 208,
481+ 208, 211, 208, 71, 188, 287, 138, 139, 140, 287,
482+ 119, 287, 287, 0, 194, 0, 0, 0, 0, 183,
483+ 188, 0, 0, 97, 187, 190, 0, 0, 0, 184,
484+ 184, 174, 182, 181, 0, 0, 0, 0, 0, 0,
485+ 171, 0, 171, 182, 0, 0, 169, 162, 163, 174,
486+ 0, 0, 0, 0, 0, 177, 166, 130, 166, 0,
487+ 0, 157, 166, 155, 169, 0, 0, 155, 155, 166,
488+ 152, 0, 163, 148, 153, 0, 0, 146, 158, 138,
489+ 0, 0, 149, 156, 153, 0, 141, 140, 139, 0,
490+
491+ 0, 135, 98, 0, 146, 81, 0, 0, 0, 0,
492+ 0, 0, 70, 63, 38, 0, 0, 287, 171, 176,
493+ 179, 181, 183, 184
494494 } ;
495495
496-static const flex_int16_t yy_def[227] =
496+static const flex_int16_t yy_def[225] =
497497 { 0,
498- 220, 1, 220, 220, 220, 220, 220, 221, 222, 220,
499- 220, 220, 220, 220, 220, 220, 220, 223, 220, 224,
500- 225, 220, 220, 220, 220, 220, 220, 226, 226, 226,
501- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
502- 226, 226, 226, 226, 220, 220, 220, 220, 221, 220,
503- 220, 220, 221, 221, 222, 220, 220, 220, 220, 220,
504- 220, 220, 220, 220, 220, 223, 220, 220, 224, 225,
505- 220, 220, 220, 220, 220, 226, 226, 226, 226, 226,
506- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
507- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
508-
509- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
510- 226, 226, 226, 226, 226, 220, 220, 221, 221, 220,
511- 220, 220, 220, 226, 226, 226, 226, 226, 226, 226,
512- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
513- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
514- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
515- 226, 226, 226, 226, 226, 226, 226, 220, 226, 226,
516- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
517- 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
518- 220, 226, 226, 226, 226, 226, 226, 226, 226, 226,
519-
520- 226, 226, 226, 226, 226, 226, 220, 226, 226, 226,
521- 226, 226, 226, 226, 226, 226, 226, 226, 226, 0,
522- 220, 220, 220, 220, 220, 220
498+ 218, 1, 218, 218, 218, 218, 218, 219, 220, 218,
499+ 218, 218, 218, 218, 218, 218, 218, 221, 218, 222,
500+ 223, 218, 218, 218, 218, 218, 218, 224, 224, 224,
501+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
502+ 224, 224, 224, 224, 218, 218, 218, 218, 219, 218,
503+ 218, 218, 219, 219, 220, 218, 218, 218, 218, 218,
504+ 218, 218, 218, 218, 218, 221, 218, 218, 222, 223,
505+ 218, 218, 218, 218, 218, 224, 224, 224, 224, 224,
506+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
507+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
508+
509+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
510+ 224, 224, 224, 224, 224, 218, 218, 219, 219, 218,
511+ 218, 218, 218, 224, 224, 224, 224, 224, 224, 224,
512+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
513+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
514+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
515+ 224, 224, 224, 224, 224, 224, 224, 218, 224, 224,
516+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
517+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 218,
518+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
519+
520+ 224, 224, 224, 224, 218, 224, 224, 224, 224, 224,
521+ 224, 224, 224, 224, 224, 224, 224, 0, 218, 218,
522+ 218, 218, 218, 218
523523 } ;
524524
525-static const flex_int16_t yy_nxt[349] =
525+static const flex_int16_t yy_nxt[347] =
526526 { 0,
527527 4, 4, 5, 6, 7, 8, 9, 10, 11, 12,
528528 13, 14, 15, 16, 17, 18, 19, 20, 21, 21,
@@ -531,40 +531,40 @@ static const flex_int16_t yy_nxt[349] =
531531 34, 28, 28, 35, 36, 37, 38, 39, 40, 28,
532532 41, 42, 43, 44, 28, 28, 45, 46, 47, 48,
533533 59, 61, 63, 49, 71, 72, 74, 75, 77, 86,
534- 78, 92, 87, 60, 93, 219, 64, 62, 88, 79,
534+ 78, 92, 87, 60, 93, 217, 64, 62, 88, 79,
535535 80, 89, 81, 102, 50, 82, 90, 108, 94, 95,
536- 220, 96, 91, 117, 97, 83, 103, 117, 110, 111,
536+ 218, 96, 91, 117, 97, 83, 103, 117, 110, 111,
537537
538- 218, 112, 118, 109, 113, 84, 119, 121, 85, 98,
539- 130, 165, 121, 217, 166, 99, 131, 100, 66, 66,
538+ 216, 112, 118, 109, 113, 84, 119, 121, 85, 98,
539+ 130, 165, 121, 215, 166, 99, 131, 100, 66, 66,
540540 66, 66, 66, 66, 66, 66, 133, 135, 140, 138,
541- 143, 168, 216, 168, 136, 134, 139, 141, 215, 117,
542- 118, 118, 144, 117, 119, 119, 173, 174, 191, 191,
543- 191, 191, 191, 191, 191, 207, 207, 207, 207, 207,
544- 207, 207, 207, 207, 207, 207, 207, 207, 207, 207,
545- 207, 53, 214, 53, 53, 53, 55, 55, 55, 55,
546- 55, 66, 66, 69, 69, 70, 70, 76, 76, 213,
547- 212, 211, 210, 209, 208, 206, 205, 204, 203, 202,
548-
549- 201, 200, 199, 198, 197, 196, 195, 194, 193, 192,
550- 190, 189, 188, 187, 186, 185, 184, 183, 182, 181,
551- 180, 179, 178, 177, 176, 175, 172, 171, 170, 169,
552- 167, 164, 163, 162, 161, 160, 159, 158, 157, 156,
553- 155, 154, 153, 152, 151, 150, 149, 148, 147, 146,
554- 145, 142, 137, 132, 129, 128, 127, 126, 125, 124,
555- 123, 122, 68, 68, 120, 56, 54, 54, 116, 115,
556- 114, 107, 106, 105, 104, 101, 73, 68, 68, 67,
557- 65, 58, 57, 56, 54, 52, 51, 220, 3, 220,
558- 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
559-
560- 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
561- 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
562- 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
563- 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
564- 220, 220, 220, 220, 220, 220, 220, 220
541+ 143, 168, 214, 168, 136, 134, 139, 141, 213, 117,
542+ 118, 118, 144, 117, 119, 119, 172, 173, 190, 190,
543+ 190, 190, 190, 190, 190, 205, 205, 205, 205, 205,
544+ 205, 205, 205, 205, 205, 205, 205, 205, 205, 205,
545+ 205, 53, 212, 53, 53, 53, 55, 55, 55, 55,
546+ 55, 66, 66, 69, 69, 70, 70, 76, 76, 211,
547+ 210, 209, 208, 207, 206, 204, 203, 202, 201, 200,
548+
549+ 199, 198, 197, 196, 195, 194, 193, 192, 191, 189,
550+ 188, 187, 186, 185, 184, 183, 182, 181, 180, 179,
551+ 178, 177, 176, 175, 174, 171, 170, 169, 167, 164,
552+ 163, 162, 161, 160, 159, 158, 157, 156, 155, 154,
553+ 153, 152, 151, 150, 149, 148, 147, 146, 145, 142,
554+ 137, 132, 129, 128, 127, 126, 125, 124, 123, 122,
555+ 68, 68, 120, 56, 54, 54, 116, 115, 114, 107,
556+ 106, 105, 104, 101, 73, 68, 68, 67, 65, 58,
557+ 57, 56, 54, 52, 51, 218, 3, 218, 218, 218,
558+ 218, 218, 218, 218, 218, 218, 218, 218, 218, 218,
559+
560+ 218, 218, 218, 218, 218, 218, 218, 218, 218, 218,
561+ 218, 218, 218, 218, 218, 218, 218, 218, 218, 218,
562+ 218, 218, 218, 218, 218, 218, 218, 218, 218, 218,
563+ 218, 218, 218, 218, 218, 218, 218, 218, 218, 218,
564+ 218, 218, 218, 218, 218, 218
565565 } ;
566566
567-static const flex_int16_t yy_chk[349] =
567+static const flex_int16_t yy_chk[347] =
568568 { 0,
569569 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
570570 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -573,37 +573,37 @@ static const flex_int16_t yy_chk[349] =
573573 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
574574 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
575575 14, 15, 17, 2, 24, 24, 26, 26, 29, 31,
576- 29, 33, 31, 14, 33, 217, 17, 15, 31, 30,
576+ 29, 33, 31, 14, 33, 215, 17, 15, 31, 30,
577577 30, 32, 30, 36, 2, 30, 32, 41, 34, 34,
578578 66, 34, 32, 48, 34, 30, 36, 48, 42, 42,
579579
580- 216, 42, 49, 41, 42, 30, 49, 66, 30, 34,
581- 83, 114, 66, 215, 114, 34, 83, 34, 68, 68,
580+ 214, 42, 49, 41, 42, 30, 49, 66, 30, 34,
581+ 83, 114, 66, 213, 114, 34, 83, 34, 68, 68,
582582 68, 68, 68, 68, 68, 68, 85, 86, 89, 88,
583- 91, 121, 208, 121, 86, 85, 88, 89, 205, 117,
583+ 91, 121, 206, 121, 86, 85, 88, 89, 203, 117,
584584 118, 119, 91, 117, 118, 119, 134, 134, 168, 168,
585- 168, 168, 168, 168, 168, 191, 191, 191, 191, 191,
586- 191, 191, 191, 207, 207, 207, 207, 207, 207, 207,
587- 207, 221, 204, 221, 221, 221, 222, 222, 222, 222,
588- 222, 223, 223, 224, 224, 225, 225, 226, 226, 201,
589- 200, 199, 197, 196, 195, 190, 189, 186, 185, 184,
590-
591- 182, 181, 180, 179, 176, 175, 174, 173, 172, 169,
592- 167, 166, 160, 159, 158, 157, 154, 153, 151, 144,
593- 143, 142, 141, 140, 136, 135, 132, 131, 130, 125,
594- 115, 113, 112, 111, 110, 109, 108, 107, 106, 105,
595- 104, 103, 102, 101, 99, 97, 96, 95, 94, 93,
596- 92, 90, 87, 84, 82, 81, 80, 79, 78, 77,
597- 75, 71, 70, 69, 65, 55, 54, 53, 46, 44,
598- 43, 40, 39, 38, 37, 35, 25, 21, 20, 19,
599- 18, 11, 10, 9, 8, 7, 6, 3, 220, 220,
600- 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
601-
602- 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
603- 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
604- 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
605- 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
606- 220, 220, 220, 220, 220, 220, 220, 220
585+ 168, 168, 168, 168, 168, 190, 190, 190, 190, 190,
586+ 190, 190, 190, 205, 205, 205, 205, 205, 205, 205,
587+ 205, 219, 202, 219, 219, 219, 220, 220, 220, 220,
588+ 220, 221, 221, 222, 222, 223, 223, 224, 224, 199,
589+ 198, 197, 195, 194, 193, 189, 188, 185, 184, 183,
590+
591+ 181, 180, 179, 178, 175, 174, 173, 172, 169, 167,
592+ 166, 160, 159, 158, 157, 154, 153, 151, 144, 143,
593+ 142, 141, 140, 136, 135, 131, 130, 125, 115, 113,
594+ 112, 111, 110, 109, 108, 107, 106, 105, 104, 103,
595+ 102, 101, 99, 97, 96, 95, 94, 93, 92, 90,
596+ 87, 84, 82, 81, 80, 79, 78, 77, 75, 71,
597+ 70, 69, 65, 55, 54, 53, 46, 44, 43, 40,
598+ 39, 38, 37, 35, 25, 21, 20, 19, 18, 11,
599+ 10, 9, 8, 7, 6, 3, 218, 218, 218, 218,
600+ 218, 218, 218, 218, 218, 218, 218, 218, 218, 218,
601+
602+ 218, 218, 218, 218, 218, 218, 218, 218, 218, 218,
603+ 218, 218, 218, 218, 218, 218, 218, 218, 218, 218,
604+ 218, 218, 218, 218, 218, 218, 218, 218, 218, 218,
605+ 218, 218, 218, 218, 218, 218, 218, 218, 218, 218,
606+ 218, 218, 218, 218, 218, 218
607607 } ;
608608
609609 static const flex_int16_t yy_rule_linenum[95] =
@@ -1031,13 +1031,13 @@ yy_match:
10311031 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
10321032 {
10331033 yy_current_state = (int) yy_def[yy_current_state];
1034- if ( yy_current_state >= 221 )
1034+ if ( yy_current_state >= 219 )
10351035 yy_c = yy_meta[yy_c];
10361036 }
10371037 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
10381038 ++yy_cp;
10391039 }
1040- while ( yy_current_state != 220 );
1040+ while ( yy_current_state != 218 );
10411041 yy_cp = (yy_last_accepting_cpos);
10421042 yy_current_state = (yy_last_accepting_state);
10431043
@@ -1995,7 +1995,7 @@ int yyFlexLexer::yy_get_next_buffer()
19951995 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
19961996 {
19971997 yy_current_state = (int) yy_def[yy_current_state];
1998- if ( yy_current_state >= 221 )
1998+ if ( yy_current_state >= 219 )
19991999 yy_c = yy_meta[yy_c];
20002000 }
20012001 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -2028,11 +2028,11 @@ int yyFlexLexer::yy_get_next_buffer()
20282028 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
20292029 {
20302030 yy_current_state = (int) yy_def[yy_current_state];
2031- if ( yy_current_state >= 221 )
2031+ if ( yy_current_state >= 219 )
20322032 yy_c = yy_meta[yy_c];
20332033 }
20342034 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
2035- yy_is_jam = (yy_current_state == 220);
2035+ yy_is_jam = (yy_current_state == 218);
20362036
20372037 return yy_is_jam ? 0 : yy_current_state;
20382038 }
--- /dev/null
+++ b/phrase.cpp
@@ -0,0 +1,558 @@
1+/*
2+ * phrase.cpp
3+ *
4+ * Copyright 2020 dhrname <dhrname@joestar.sakura.ne.jp>
5+ *
6+ * This program is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License as published by
8+ * the Free Software Foundation; either version 2 of the License, or
9+ * (at your option) any later version.
10+ *
11+ * This program is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ * GNU General Public License for more details.
15+ *
16+ * You should have received a copy of the GNU General Public License
17+ * along with this program; if not, write to the Free Software
18+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19+ * MA 02110-1301, USA.
20+ *
21+ *
22+ */
23+
24+#include "include/node.hpp"
25+#include "include/phrase.hpp"
26+
27+
28+using namespace std;
29+using namespace jstr;
30+using namespace parser::terminal;
31+using namespace parser::nonterminal;
32+
33+/*setSemanticValue メンバ関数
34+ * ネットワークの固有値を設定する*/
35+void SemanticNetwork::setSemanticValue(const std::string& name)
36+{
37+ nameSpace = name;
38+}
39+
40+void SemanticNetwork::setReference(Node *const nod)
41+{
42+ link = nod;
43+}
44+
45+Node* SemanticNetwork::getReference()
46+{
47+ return link;
48+}
49+
50+
51+/*isMetaメンバ関数
52+* 自身が非終端記号(超記号、メタ記号、meta symbol)かどうかを真偽値で返す
53+* 非終端記号であれば、trueとなる*/
54+bool Phrase::isMeta()
55+{
56+ return false;
57+}
58+
59+
60+/*setSemanticValue メンバ関数のオーバライド
61+* 文字列データを設定する
62+* IDENTIFIERなどで使用されることを想定*/
63+void Phrase::setSemanticValue(const std::string& v)
64+{
65+ value = v;
66+}
67+
68+/*setClonePhrase メンバ関数
69+* clonePhraseメンバを設定しておく*/
70+void Phrase::setClonePhrase(Phrase* p)
71+{
72+ if (nullptr == p)
73+ {
74+ /*バグの放置を防ぐため、例外を投げる前に、エラーを出力して報告*/
75+ std::cerr << "NULL Argument Error on the member " << this->className << "::setClonePhrase(null)" << std::endl;
76+ throw std::invalid_argument("error!");
77+ }
78+ clonePhrase = p;
79+}
80+
81+/*setCoordinate メンバ関数
82+* BNF記法を三次元配列化したものの、座標位置を設定
83+* 文法にマッチした記号が三次元配列のどこに配置されているかがわかる*/
84+void Phrase::setCoordinate(const int32_t x, const int32_t y, const int32_t z)
85+{
86+ if (x >= INT_MAX || x <= INT_MIN
87+ || y >= INT_MAX || y <= INT_MIN
88+ || z >= INT_MAX || z <= INT_MIN)
89+ {
90+ /*バグの放置を防ぐため、例外を投げる前に、エラーを出力して報告*/
91+ std::cerr << "Overflow Argument Error on the member " << this->className << "::setCoordinate(INT_MAX or INT_MIN)" << std::endl;
92+ throw std::invalid_argument("error!");
93+ }
94+ coordinateX.push_back(x);
95+ coordinateY.push_back(y);
96+ coordinateZ.push_back(z);
97+
98+ if (clonePhrase != nullptr)
99+ {
100+ /*clonePhraseが相互参照する可能性があるので注意*/
101+ clonePhrase->setCoordinate(x, y, z);
102+ }
103+}
104+
105+/*initializeCoordinate メンバ関数
106+* BNF記法を三次元配列化したものの、座標位置を初期化
107+* 文法にマッチした記号が三次元配列のどこに配置されているかがわかる*/
108+void Phrase::initializeCoordinate()
109+{
110+ for (int32_t k = 0; k<BNF_CONCATNATION_LENGTH;k++)
111+ {
112+ for (int32_t j = 0; j<BNF_SELECTION_LENGTH;j++)
113+ {
114+ for (int32_t i = 0;i<BNF_NONTERMINAL_LENGTH;i++)
115+ {
116+ int32_t id = jstr::parser::BNF[i][j][k];
117+ if (id <= 0)
118+ {
119+ /*bnfを疎な配列と見なして最適化*/
120+ break;
121+ }
122+ else if (id == getSymbolId())
123+ {
124+ setCoordinate(i, j, k);
125+ }
126+ }
127+ }
128+ }
129+}
130+
131+/*isNonterminalSymbolId メンバ関数
132+ * 引数idが非終端記号であれば、true、
133+ * そうでなければ、falseを返す*/
134+bool Phrase::isNonterminalSymbolId(const int32_t id)
135+{
136+ if ( (id > NONTERMINAL_SYMBOL_BEGINNING)
137+ && (id < NONTERMINAL_SYMBOL_ENDING) )
138+ {
139+ return true;
140+ }
141+ else
142+ {
143+ return false;
144+ }
145+}
146+
147+/*isTerminalSymbolId メンバ関数
148+ * 引数idが終端記号であれば、true、
149+ * そうでなければ、falseを返す*/
150+bool Phrase::isTerminalSymbolId(const int32_t id)
151+{
152+ if ( (id > TERMINAL_SYMBOL_BEGINNING)
153+ && (id < TERMINAL_SYMBOL_ENDING) )
154+ {
155+ return true;
156+ }
157+ else
158+ {
159+ return false;
160+ }
161+}
162+
163+void Phrase::setSymbolId(const int32_t num)
164+{
165+ if (!isTerminalSymbolId(num))
166+ {
167+ std::cerr << "Argument Error id:"<< num << " on the member Phrase::setSymbolId" << std::endl;
168+ throw std::invalid_argument("error!");
169+ }
170+ isUndefinedSymbolId = false;
171+ symbolId = num;
172+}
173+
174+int32_t Phrase::getSymbolId()
175+{
176+ return symbolId;
177+}
178+
179+/*isKey メンバ関数
180+* この句が予約語(BNF定義で一度だけ現われる)かどうか*/
181+bool Phrase::isKey()
182+{
183+ if (coordinateX.size() <= 2)
184+ {
185+ return true;
186+ }
187+ else
188+ {
189+ return false;
190+ }
191+}
192+
193+/*isMetaBySymbolIdメンバ関数
194+* 引数idの値が非終端記号であれば、trueとなる。終端記号ならばfasle
195+* 空文字列など負の値であれば、エラー*/
196+bool Phrase::isMetaBySymbolId(int32_t id)
197+{
198+ if (isNonterminalSymbolId(id))
199+ {
200+ /*もし、idが非終端記号であれば*/
201+ return true;
202+ }
203+ else if (isTerminalSymbolId(id))
204+ {
205+ return false;
206+ }
207+ else
208+ {
209+ /*引数idが非終端記号でも終端記号でもなく不正な値である*/
210+ std::cerr << "Argument Error id:"<< id << " on the function Phrase::isMetaBySymbolId member" << std::endl;
211+ throw std::invalid_argument("error!");
212+ }
213+}
214+
215+void MetaPhrase::setSymbolId(const int32_t num)
216+{
217+ if (!isNonterminalSymbolId(num))
218+ {
219+ std::cerr << "Argument Error id#"<< num << " on the member " << "MetaPhrase::setSymbolId" << std::endl;
220+ throw std::invalid_argument("error!");
221+ }
222+ isUndefinedSymbolId = false;
223+ symbolId = num;
224+}
225+
226+bool MetaPhrase::isMeta()
227+{
228+ return true;
229+}
230+
231+/*setFirstSetBySymbolId メンバ関数
232+ * 非終端記号を示す引数idを元にFIRST集合(先頭記号集合)を設定する*/
233+void MetaPhrase::setFirstSetBySymbolId(const int32_t id)
234+{
235+ if ( !isMetaBySymbolId(id) || (id > BNF_NONTERMINAL_LENGTH))
236+ {
237+ /*idが負の値か、終端記号である場合*/
238+ std::cerr << "SymbolId Error id:"<< id << " on the function Phrase::setFirstSetBySymbolId member" << std::endl;
239+ throw std::errc::value_too_large;
240+ }
241+
242+ for (int32_t i = 0; i<BNF_SELECTION_LENGTH;++i)
243+ {
244+ /*tはBNF定義の終端記号か非終端記号のどちらかを示す*/
245+ int32_t t = static_cast<int32_t>(jstr::parser::BNF[id][i][0]);
246+
247+ if (t <= 0)
248+ {
249+ /*tが空文字列やBNF開始記号の場合、何もしない*/
250+ }
251+ else if (t == symbolId)
252+ {
253+ /*tが自分自身と一致する場合、
254+ * すなわち、再帰で繰り返す場合、何もしない*/
255+ }
256+ else if (this->isMetaBySymbolId(t))
257+ {
258+ /*First集合が互いに疎でない場合、
259+ * あるいはBNFが左再帰の場合、
260+ * または列挙体のparser::nonterminalとBNFが合致しない場合、
261+ * ここを永久に繰り返す
262+ *
263+ * もし繰り返しが問題になれば、lex.lの列挙体も調べよ*/
264+ setFirstSetBySymbolId(t);
265+ }
266+ else
267+ {
268+ /*BNF定義の先頭記号をfirst集合に入れておく*/
269+ firstSet.insert(t);
270+ }
271+ }
272+}
273+
274+/*getFirstSet メンバ関数
275+ * BNF定義を元にFIRST集合(先頭記号集合)を求める*/
276+std::unordered_set<int32_t>& MetaPhrase::getFirstSet()
277+{
278+
279+ if (isUndefinedSymbolId)
280+ {
281+ return firstSet;
282+ }
283+
284+ setFirstSetBySymbolId(symbolId);
285+
286+ return firstSet;
287+}
288+
289+/*setFollowSetBySymbolId メンバ関数
290+ * 非終端記号を示す引数nextidを元にFOLLOW集合(後続記号集合)を設定する
291+ * このとき、nextidは後続記号となる非終端記号である*/
292+void MetaPhrase::setFollowSetBySymbolId(const int32_t nextid)
293+{
294+ /*あらかじめ、後続記号となる非終端記号のFIRST集合を作っておく*/
295+ const std::unordered_set<int32_t> fset = getFirstSet();
296+ for (auto v : fset)
297+ {
298+ /*BNF定義の後続記号をfollow集合に入れておく*/
299+ followSet.insert(v);
300+ }
301+}
302+
303+/*setFollowSet メンバ関数
304+ * coordinateXメンバなどを参考にFOLLOW集合を設定する*/
305+void MetaPhrase::setFollowSet()
306+{
307+ int32_t size = static_cast<int32_t>(coordinateX.size());
308+ if (1 == size)
309+ {
310+ /*座標値が初期値のままだと、例外を投げる*/
311+ std::cerr << "Phrase::coordinateX,Y,Z Undefined Error on the function MetaPhrase::setFollowSet member" << std::endl;
312+ throw std::errc::value_too_large;
313+ }
314+ for (int32_t i = 0; i < size; ++i)
315+ {
316+ /*yはBNFのy番目の選択肢であることを示す。
317+ * xはBNFの非終端記号のid
318+ * zはBNFのz番目の連接*/
319+ int32_t y = coordinateY[i];
320+ int32_t x = coordinateX[i];
321+ int32_t z = coordinateZ[i];
322+ if ( (0 >= y) && (BNF_SELECTION_LENGTH <= (y+1) )
323+ && (0 >= x) && (BNF_NONTERMINAL_LENGTH <= x)
324+ && (0 >= z) && (BNF_CONCATNATION_LENGTH <= z) )
325+ {
326+ std::cerr << "Phrase::coordinateX,Y,Z Range Error x:"<< x << ", y:" << y << ", z:" << z << " on the function MetaPhrase::setFollowSet member" << std::endl;
327+ throw std::errc::value_too_large;
328+ }
329+ else
330+ {
331+ int32_t nextid = jstr::parser::BNF[x][y+1][z];
332+ setFollowSetBySymbolId(nextid);
333+ }
334+ }
335+}
336+
337+/*getFollowSet メンバ関数
338+ * BNF定義における記号候補を元にFOLLOW集合(後続記号集合)を求める*/
339+std::unordered_set<int32_t>& MetaPhrase::getFollowSet()
340+{
341+ if (isUndefinedSymbolId)
342+ {
343+ return followSet;
344+ }
345+ setFollowSet();
346+ return followSet;
347+}
348+
349+const std::string& Arrow::getId()
350+{
351+ return id;
352+}
353+
354+void Arrow::setDomain(const std::string& dom = "#empty")
355+{
356+ domain = dom;
357+}
358+
359+void Arrow::setCodomain(const std::string& codom = "#empty")
360+{
361+ codomain = codom;
362+}
363+
364+const std::string& Arrow::getDomain()
365+{
366+ return domain;
367+}
368+
369+const std::string& Arrow::getCodomain()
370+{
371+ return codomain;
372+}
373+
374+
375+void Functor::throwMapMatchError(const std::string& name, const std::string& mapName, const std::string& memberName)
376+{
377+ /*バグの放置を防ぐため、例外を投げる前に、エラーを出力して報告*/
378+ std::cerr << "No Match" << mapName << " Error on the member " << memberName <<"(" << name << ")" << std::endl;
379+ throw std::invalid_argument("error!");
380+}
381+
382+/*setMap メンバ関数
383+* 射から射への写像を設定して、関手をつくる*/
384+void Functor::setMap(Arrow* dom, Arrow* cod)
385+{
386+ arrowmap[dom->getId()] = cod;
387+ objectmap[dom->getDomain()] = cod->getDomain();
388+ objectmap[dom->getCodomain()] = cod->getCodomain();
389+ this->setDomain(dom->getId());
390+ this->setCodomain(cod->getId());
391+}
392+
393+bool Functor::hasArrowMap(const std::string& name)
394+{
395+ return arrowmap.contains(name);
396+}
397+
398+/*getArrow メンバ関数
399+* 関手の射関数として、射を返す*/
400+Arrow* Functor::getArrow(const std::string& name)
401+{
402+ if ( !hasArrowMap(name) )
403+ {
404+ throwMapMatchError(name, " ArrowMap", "Functor::getArrow");
405+ }
406+ return arrowmap[name];
407+}
408+
409+/*getObjectMap メンバ関数
410+* 関手の対象関数として、対象、ここでは文字列を返す*/
411+std::string& Functor::getObjectMap(const std::string& name)
412+{
413+ return objectmap[name];
414+}
415+
416+
417+/*setMap メンバ関数
418+* 関手から関手への写像を設定して、自然であるような可換をつくる*/
419+void NaturalTransformation::setFunctorMap(Functor* dom, Functor* cod)
420+{
421+ functormap[dom->getId()] = cod;
422+ this->setDomain(dom->getId());
423+ this->setCodomain(cod->getId());
424+}
425+
426+/*getFunctorMap メンバ関数
427+* 関手の射関数として、関手を返す*/
428+Functor* NaturalTransformation::getFunctorMap(const std::string& name)
429+{
430+ if ( !functormap.contains(name) )
431+ {
432+ this->throwMapMatchError(name, " FunctorMap", "NaturalTransformation::getFunctorMap");
433+ }
434+ return functormap[name];
435+}
436+
437+
438+void IncludeFileModule::setSemanticValue(const std::string& name)
439+{
440+ fileName = name;
441+}
442+
443+/*adjoint メンバ関数
444+* 随伴射の追加
445+* 引数のarrを追加して、後述のchoiceBifunctorでarrを呼び出せるようにする*/
446+void CartesianProductModel::adjoint(Arrow* arr)
447+{
448+ /*arrを随伴射として設定しておく*/
449+ arrowmap[arr->getId()] = arr;
450+
451+ /*TO DO
452+ * 射f:arr.domain -> arr.idと、射g:arr.codomain -> arr.id
453+ * について、f = g ∘ arrの合成射になるようなfとgをつくること */
454+}
455+
456+/*choiceArrow メンバ関数
457+* 射をダイクストラ選択する関数*/
458+Arrow* CartesianProductModel::choiceArrow(const std::string& name)
459+{
460+ if ( !this->hasArrowMap(name) )
461+ {
462+ /*どのコドメインにも含まれていない場合、
463+ * エラーとみなす*/
464+ this->throwMapMatchError(name, " FunctorMap", "CartesianProductModel::choiceBifunctor");
465+ }
466+ return this->getArrow(name);
467+}
468+
469+
470+/*getUnionMap メンバ関数
471+* 直和集合を示すマップを返す
472+* 後述するdisjointメンバ関数で使う*/
473+std::unordered_map<std::string, UnionModel*> UnionModel::getUnionMap()
474+{
475+ return unionmap;
476+}
477+
478+/*disjoint メンバ関数
479+* 引数のuniと、自身を和集合として、直和を構成する*/
480+void UnionModel::disjoint(UnionModel* uni)
481+{
482+ if (nullptr == uni)
483+ {
484+ throwMapMatchError("nullptr", " UnionMap", "UnionModel::disjoint");
485+ }
486+ unionmap.merge(uni->getUnionMap());
487+ unionmap[uni->getId()] = uni;
488+}
489+
490+/*getUnionModel メンバ関数
491+* 引数nameで指定されたUnionModelのポインタを返す*/
492+UnionModel* UnionModel::getUnionModel(const std::string& name)
493+{
494+ if ( unionmap.contains(name) )
495+ {
496+ return unionmap[name];
497+ }
498+ else
499+ {
500+ /*unionmapには自分自身は含まれていないことに注意*/
501+ return this;
502+ }
503+}
504+
505+
506+void PowerSetModel::setBoolMap(const std::string& name, const bool tf)
507+{
508+ boolmap[name] = tf;
509+}
510+
511+/*hasElement メンバ関数
512+* べき集合Bに含まれるPowerSetElementクラスの要素S( すなわち、S∈B, S⊆B )に対して、name∈Sかどうかを要素判定
513+* 「構造化プログラミング 第二部 データ構造化」のin操作を参照*/
514+bool PowerSetModel::hasElement(const std::string& name)
515+{
516+ if ( !boolmap.contains(name) )
517+ {
518+ /*キャッシュしておく*/
519+
520+ boolmap[name] = false;
521+ return false;
522+ }
523+ else
524+ {
525+ return boolmap[name];
526+ }
527+}
528+
529+
530+/*addSetOf メンバ関数
531+* 対象となる集合eleを追加する*/
532+void PowerSetElementModel::addSetOf(PowerSetModel* ele)
533+{
534+ targetSet = ele;
535+}
536+
537+void PowerSetElementModel::adjoint(Arrow* arr)
538+{
539+ targetSet->adjoint(arr);
540+ targetSet->setBoolMap(arr->getId(), true);
541+ this->setBoolMap(arr->getId(), true);
542+ this->CartesianProductModel::adjoint(arr);
543+}
544+
545+
546+/*hasElement メンバ関数
547+* べき集合Bに含まれるPowerSetElementクラスの要素S( すなわち、S∈B, S⊆B )に対して、name∈Sかどうかを要素判定
548+* 「構造化プログラミング 第二部 データ構造化」のin操作を参照*/
549+bool PowerSetElementModel::hasElement(const std::string& name)
550+{
551+ return this->hasArrowMap(name);
552+}
553+
554+
555+bool IntegerTypeValue::isUnsigned()
556+{
557+ return !isSigned;
558+}
--- /dev/null
+++ b/test/.gitignore
@@ -0,0 +1 @@
1+/googletest/
--- a/test/classtest.j
+++ b/test/classtest.j
@@ -91,22 +91,22 @@ main:
9191 delete ob;
9292 ;
9393
94-class wp:
94+cla wp:
9595 ...
9696 ;
9797
98-class w:
98+cla w:
9999 i08 i = 0;
100100 ...
101101 ;
102102
103-class hoge:
103+cla hoge:
104104 ...
105105 *.f:
106106 ;
107107 ;
108108
109-class hogehoge:
109+cla hogehoge:
110110 i32 i = 0;
111111 ...
112112 *.ff:
@@ -114,7 +114,7 @@ class hogehoge:
114114 ;
115115 ;
116116
117-class Hg < hogehoge < hoge:
117+cla Hg < hogehoge < hoge:
118118 i32 i = 35;
119119 i64 j = 12;
120120 ...
@@ -129,7 +129,7 @@ class Hg < hogehoge < hoge:
129129 ;
130130 ;
131131
132-class Hf:
132+cla Hf:
133133 i32 i = 0
134134 ...
135135 *.ffg:
@@ -137,7 +137,7 @@ class Hf:
137137 ;
138138 ;
139139
140-class Hh < Hg < Hf:
140+cla Hh < Hg < Hf:
141141 i32 i = 0;
142142 ...
143143 *.ffff:
--- a/test/commenttest.j
+++ b/test/commenttest.j
@@ -12,7 +12,7 @@ main:
1212 ;
1313
1414 #class hoge
15-class hoge:
15+cla hoge:
1616 #class hoge
1717 #日本語のテスト
1818 i08 a = 0;
@@ -25,9 +25,9 @@ class hoge:
2525 ;
2626 ;
2727
28-##class hogehoge####
28+##cla hogehoge####
2929
30-class hogehoge:
30+cla hogehoge:
3131 i32 i = 0;
3232 ...
3333 *.f:#class hogehoge
@@ -35,7 +35,7 @@ class hogehoge:
3535 ;#class hogehoge
3636 ;
3737
38-class Hg < hogehoge < hoge:#Hg
38+cla Hg < hogehoge < hoge:#Hg
3939 i32 i = 35;
4040 ...
4141 *.f:
@@ -46,7 +46,7 @@ class Hg < hogehoge < hoge:#Hg
4646 ;
4747 ;
4848
49-class Hh < Hg:
49+cla Hh < Hg:
5050 i32 i = 0;
5151 ...
5252 *.f:
--- /dev/null
+++ b/test/coroutine.j
@@ -0,0 +1,56 @@
1+main:
2+ obj o = new hoge();
3+ obj oa = new hogehoge(i:12);
4+ o.f();
5+ delete o;
6+ delete oa;
7+;
8+
9+class hoge:
10+ detach;
11+ ...
12+ *.f:
13+ ;
14+;
15+
16+class hogehoge:
17+ i32 i = 0;
18+ detach;
19+ ...
20+ *.f:
21+ ;
22+;
23+
24+class Hg:
25+ i32 i = 35;
26+ obj h = new hoge();
27+ ...
28+ *.f:
29+ call h;
30+ ;
31+ *.g:
32+ ;
33+;
34+
35+class Hh:
36+ i32 i = 0;
37+ obj h = new Hg();
38+ call h;
39+ obj w = new hoge();
40+ ...
41+ *.f:
42+ w.f();
43+ ;
44+;
45+
46+class Hh:
47+ i32 i = 0;
48+ obj h = new Hg();
49+ resume h;
50+ obj w = new hoge();
51+ ...
52+ *.f:
53+ w.f();
54+ ;
55+;
56+end;
--- a/test/datatypetest.j
+++ b/test/datatypetest.j
@@ -34,11 +34,11 @@ main:
3434 ;
3535 ;
3636
37-class hh:
37+cla hh:
3838 ...
3939 ;
4040
41-class hoge:
41+cla hoge:
4242 i08 a = 0;
4343 i16 b = 0;
4444 i32 c = 0;
@@ -81,7 +81,7 @@ class hoge:
8181 ;
8282 ;
8383
84-class hogehoge:
84+cla hogehoge:
8585 i32 i = 0;
8686 ...
8787 *.f:
@@ -114,14 +114,14 @@ class hogehoge:
114114 ;
115115 ;
116116
117-class Hg < hogehoge < hoge:
117+cla Hg < hogehoge < hoge:
118118 i32 i = 35;
119119 ...
120120 *.f:
121121 ;
122122 ;
123123
124-class Hh < Hg:
124+cla Hh < Hg:
125125 i32 i = 0;
126126 err e = "ERROR!";
127127 ...
--- a/test/excepttest.j
+++ b/test/excepttest.j
@@ -15,7 +15,7 @@ main:
1515 ;
1616
1717
18-class hoge:
18+cla hoge:
1919 i08 a = 0;
2020 detach;
2121 obj o = new hoge();
@@ -27,7 +27,7 @@ class hoge:
2727 ;
2828 ;
2929
30-class hogehoge:
30+cla hogehoge:
3131 i32 i = 0;
3232 ...
3333 *.f:
@@ -35,7 +35,7 @@ class hogehoge:
3535 ;
3636 ;
3737
38-Hg < hogehoge < hoge:
38+cla Hg < hogehoge < hoge:
3939 i32 i = 35;
4040 ...
4141 *.f:
@@ -46,7 +46,7 @@ Hg < hogehoge < hoge:
4646 ;
4747 ;
4848
49-class Hh < Hg:
49+cla Hh < Hg:
5050 i32 i = 0;
5151 ...
5252 *.f:
--- /dev/null
+++ b/test/expecttest.j
@@ -0,0 +1,64 @@
1+main:
2+ i08 i = 0;
3+ expect:
4+ i = 0;
5+ i++;
6+ i > 0;
7+ i = -2;
8+ i < 0;
9+ obj o = new wp();
10+ expect o:
11+ i = 0; #error
12+ f(); #error
13+ delete o;
14+ obj ob = new hogehoge();
15+ expect ob:
16+ i = 0; #no error
17+ f(); #no error
18+ ff(); #no error
19+ i = 12;
20+ delete ob;
21+;
22+
23+cla wp:
24+ ...
25+;
26+
27+cla hoge:
28+ ...
29+ *.f:
30+ ;
31+;
32+
33+cla hogehoge:
34+ i32 i = 0;
35+ ...
36+ *.ff:
37+ i = 12;
38+ ;
39+;
40+
41+cla Hg < hogehoge < hoge:
42+ i32 i = 35;
43+ i64 j = 12;
44+ ...
45+ *.fff:
46+ ;
47+ *.g:
48+ i = 15;
49+ ;
50+ *.fg:
51+ ;
52+;
53+
54+cla Hf:
55+ ...
56+;
57+
58+cla Hh < Hg < Hf:
59+ i32 i = 0;
60+ ...
61+ *.ffff:
62+ ;
63+;
64+end;
--- /dev/null
+++ b/test/functor.j
@@ -0,0 +1,131 @@
1+main:
2+ obj o = new hoge();
3+ obj oa = new hogehoge(i:12);
4+ expect o:
5+ f();
6+ i= 0;
7+ x() = 100;
8+ i= 12;
9+ delete o;
10+
11+ #virtual quantitiy (仮想量子化) = override oa.hoge::f() -> oa.f() -> ...
12+ # = oa.hoge::f(oa.f()); 最左評価戦略なので、関手oa.hoge::fがまず評価されて、その次に、関手oa.fが評価される
13+ # = functor composite oa.f ∘ o.f
14+ expect oa:
15+ x();
16+ i=0;
17+ f();
18+ i=12;
19+ x();
20+ i=12;
21+ f(i:15);
22+ i=15; # = oa.hoge::f(oa.hogehoge::f(i:15)) で、最左評価戦略hoge::f() -> hogehoge::f()の順となる
23+ x() = 100;
24+ i=15;
25+ f(
26+ i:12
27+ );
28+ i=12;
29+ x() = 100;
30+ i= 12;
31+ delete oa;
32+
33+ obj oh = new Hg();
34+ expect oh:
35+ f();
36+ i= 35;
37+ j= 12;
38+ f(i:18);
39+ i= 18;
40+ j= 12;
41+ f(i:12);
42+ k= 0.0;
43+ m= 0;
44+ g();
45+ i= 12;
46+ k= 100.01;
47+ m= 100;
48+ g(i:15);
49+ i=15;
50+ f(
51+ i: 12,
52+ j: 15
53+ );
54+ i= 12;
55+ j= 15;
56+ fg();
57+ i=12;
58+ j=100;
59+ delete oh;
60+ obj ob = new Hh(i:12);
61+ expect ob:
62+ f();
63+ p();
64+ i=12;
65+ g();
66+ i=17;
67+ p();
68+ i=17;
69+ g(i:15);
70+ i=17;
71+ p();
72+ i=15;
73+ delete ob;
74+;
75+
76+cla wp:
77+ ...
78+;
79+
80+cla hoge:
81+ i32 i = 0;
82+ ...
83+ *.f:
84+ ;
85+;
86+
87+cla hogehoge:
88+ i32 i = 0;
89+ ...
90+ *.f:
91+ i = 12;
92+ ;
93+ *.x:
94+ monad<i32> 100;
95+ monad<f32> 100.01;
96+ ;
97+;
98+
99+cla Hg < hogehoge < hoge:
100+ i32 i = 35;
101+ i64 j = 12;
102+ f32 k = 0.0;
103+ i32 m = 0;
104+ ...
105+ *.f:
106+ ;
107+ *.g:
108+ m = x();
109+ k = x();
110+ ;
111+ *.fg:
112+ j = 100;
113+ ;
114+;
115+
116+cla Hf:
117+ ...
118+;
119+
120+cla Hh < Hg < Hf:
121+ i32 i = 0;
122+ ...
123+ *.f:
124+ ;
125+ *.g:
126+ i = 17;
127+ ;
128+ *.p:
129+ ;
130+;
131+end;
--- a/test/statementtest.j
+++ b/test/statementtest.j
@@ -82,20 +82,20 @@ main:
8282 delete ob;
8383 ;
8484
85-hoge:
85+cla hoge:
8686 ...
8787 *.f:
8888 ;
8989 ;
9090
91-class hogehoge:
91+cla hogehoge:
9292 i32 i = 0;
9393 ...
9494 *.f:
9595 ;
9696 ;
9797
98-class Hg < hogehoge < hoge:
98+cla Hg < hogehoge < hoge:
9999 i32 i = 35;
100100 ...
101101 *.f:
@@ -109,7 +109,7 @@ class Hg < hogehoge < hoge:
109109 ;
110110 ;
111111
112-class Hh < Hg:
112+cla Hh < Hg:
113113 i32 i = 0;
114114 ...
115115 *.f:
--- /dev/null
+++ b/test/whilestatementtest.j
@@ -0,0 +1,55 @@
1+main:
2+ #OK
3+ #TEST
4+ obj o = new hoge();
5+ o.f();
6+ except o:
7+ g();
8+ delete o;
9+ o = new Hh();
10+ expect o:
11+ f();
12+ f();
13+ f(i:12);
14+ delete o;
15+;
16+
17+#class hoge
18+cla hoge:
19+ i08 a = 0;
20+ c08 b = "#fwpe";
21+ ...
22+ *.f:
23+ while a > 0:
24+ while a < 0:
25+ ;
26+ ;
27+ *.g:
28+ ;
29+;
30+
31+cla hogehoge:
32+ i32 i = 0;
33+ ...
34+ *.f:
35+ ;
36+;
37+
38+cla Hg < hogehoge < hoge:
39+ i32 i = 35;
40+ ...
41+ *.f:
42+ ;
43+ *.g:
44+ if i > 35:
45+ error;
46+ ;
47+;
48+
49+cla Hh < Hg:
50+ i32 i = 0;
51+ ...
52+ *.f:
53+ ;
54+;
55+end;