• R/O
  • SSH
  • HTTPS

jpl: Commit


Commit MetaInfo

Revision471 (tree)
Time2019-03-09 07:41:37
Authorjakobthomsen

Log Message

use calls

Change Summary

Incremental Difference

--- trunk/experimental2/compiler.compiled.c (revision 470)
+++ trunk/experimental2/compiler.compiled.c (revision 471)
@@ -371,7 +371,7 @@
371371 {
372372 switch(state)
373373 {
374- case 1:
374+ case 2:
375375 {
376376
377377 /////////////////////////////////////////////////////////////////////////////
@@ -753,6 +753,43 @@
753753 printf(" {\n");
754754 printf(" switch(state)\n");
755755 printf(" {\n");
756+ state = stack_pop(&callstack);
757+
758+ break;
759+ }
760+ case 3:
761+ {
762+
763+ // outro
764+ printf(" default:\n");
765+ printf(" fprintf(stderr, \"no such state %%d\\n\", (int)state);\n");
766+ printf(" return (int)state;\n");
767+ printf(" // exit((int)state);\n");
768+ printf(" }\n");
769+ printf(" }\n");
770+ printf("\n");
771+ printf(" stack_free(&callstack);\n");
772+ printf(" mem_show();\n");
773+ printf(" mem_check();\n");
774+ printf("\n");
775+ printf(" return 0;\n");
776+ printf("}\n");
777+ printf("\n");
778+ state = stack_pop(&callstack);
779+
780+ break;
781+ }
782+ case 1:
783+ {
784+
785+ // intro
786+ stack_push(&callstack, -1LL);
787+ state = 2;
788+ break;
789+ }
790+ case -1LL:
791+ {
792+
756793 while(true)
757794 {
758795 while(isspace(ungetc(getchar(), stdin))) (void)getchar(); // skip WS
@@ -825,32 +862,14 @@
825862 state = 0;
826863
827864 // outro
828- printf(" default:\n");
829- printf(" fprintf(stderr, \"no such state %%d\\n\", (int)state);\n");
830- printf(" return (int)state;\n");
831- printf(" // exit((int)state);\n");
832- printf(" }\n");
833- printf(" }\n");
834- printf("\n");
835- printf(" stack_free(&callstack);\n");
836- printf(" mem_show();\n");
837- printf(" mem_check();\n");
838- printf("\n");
839- printf(" return 0;\n");
840- printf("}\n");
841- printf("\n");
842- state = stack_pop(&callstack);
843-
865+ stack_push(&callstack, -2LL);
866+ state = 3;
844867 break;
845868 }
846- case 2:
869+ case -2LL:
847870 {
871+state = stack_pop(&callstack);
848872
849- // test another state
850-
851- // test another state x
852- state = stack_pop(&callstack);
853-
854873 break;
855874 }
856875 default:
--- trunk/experimental2/compiler.source.c (revision 470)
+++ trunk/experimental2/compiler.source.c (revision 471)
@@ -1,5 +1,6 @@
1-1
1+2
22 {
3+
34 `
45 /////////////////////////////////////////////////////////////////////////////
56 // Another attempt writing a self-hosting compiler with own memory-management
@@ -380,6 +381,35 @@
380381 printf(" {\n");
381382 printf(" switch(state)\n");
382383 printf(" {\n");
384+ `
385+}
386+3
387+{
388+ `
389+ // outro
390+ printf(" default:\n");
391+ printf(" fprintf(stderr, \"no such state %%d\\n\", (int)state);\n");
392+ printf(" return (int)state;\n");
393+ printf(" // exit((int)state);\n");
394+ printf(" }\n");
395+ printf(" }\n");
396+ printf("\n");
397+ printf(" stack_free(&callstack);\n");
398+ printf(" mem_show();\n");
399+ printf(" mem_check();\n");
400+ printf("\n");
401+ printf(" return 0;\n");
402+ printf("}\n");
403+ printf("\n");
404+ `
405+}
406+1
407+{
408+ `
409+ // intro
410+ `
411+ 2
412+ `
383413 while(true)
384414 {
385415 while(isspace(ungetc(getchar(), stdin))) (void)getchar(); // skip WS
@@ -452,28 +482,6 @@
452482 state = 0;
453483
454484 // outro
455- printf(" default:\n");
456- printf(" fprintf(stderr, \"no such state %%d\\n\", (int)state);\n");
457- printf(" return (int)state;\n");
458- printf(" // exit((int)state);\n");
459- printf(" }\n");
460- printf(" }\n");
461- printf("\n");
462- printf(" stack_free(&callstack);\n");
463- printf(" mem_show();\n");
464- printf(" mem_check();\n");
465- printf("\n");
466- printf(" return 0;\n");
467- printf("}\n");
468- printf("\n");
469485 `
486+ 3
470487 }
471-2
472-{
473- `
474- // test another state
475- `
476- `
477- // test another state x
478- `
479-}
Show on old repository browser