about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-08-04 22:38:23 -0700
committerKartik Agaram <vc@akkartik.com>2018-08-04 22:38:23 -0700
commitaaf24db4aeca73e985437d065b36815677716694 (patch)
treec9dd0c57faefab8b468badf5bc29b36df9c68be7
parenta9985c33cbf9214c1a1de087b4491bf67f69f817 (diff)
downloadmu-aaf24db4aeca73e985437d065b36815677716694.tar.gz
4482
-rw-r--r--subx/010---vm.cc (renamed from subx/010vm.cc)0
-rw-r--r--subx/028translate.cc (renamed from subx/029translate.cc)65
-rw-r--r--subx/029transforms.cc65
3 files changed, 65 insertions, 65 deletions
diff --git a/subx/010vm.cc b/subx/010---vm.cc
index c467255b..c467255b 100644
--- a/subx/010vm.cc
+++ b/subx/010---vm.cc
diff --git a/subx/029translate.cc b/subx/028translate.cc
index 1d5e940e..f3e30126 100644
--- a/subx/029translate.cc
+++ b/subx/028translate.cc
@@ -35,71 +35,6 @@ if (is_equal(argv[1], "translate")) {
   return 0;
 }
 
-//: Ordering transforms is a well-known hard problem when building compilers.
-//: In our case we also have the additional notion of layers. The ordering of
-//: layers can have nothing in common with the ordering of transforms when
-//: SubX is tangled and run. This can be confusing for readers, particularly
-//: if later layers start inserting transforms at arbitrary points between
-//: transforms introduced earlier. Over time adding transforms can get harder
-//: and harder, having to meet the constraints of everything that's come
-//: before. It's worth thinking about organization up-front so the ordering is
-//: easy to hold in our heads, and it's obvious where to add a new transform.
-//: Some constraints:
-//:
-//:   1. Layers force us to build SubX bottom-up; since we want to be able to
-//:   build and run SubX after stopping loading at any layer, the overall
-//:   organization has to be to introduce primitives before we start using
-//:   them.
-//:
-//:   2. Transforms usually need to be run top-down, converting high-level
-//:   representations to low-level ones so that low-level layers can be
-//:   oblivious to them.
-//:
-//:   3. When running we'd often like new representations to be checked before
-//:   they are transformed away. The whole reason for new representations is
-//:   often to add new kinds of automatic checking for our machine code
-//:   programs.
-//:
-//: Putting these constraints together, we'll use the following broad
-//: organization:
-//:
-//:   a) We'll divide up our transforms into "levels", each level consisting
-//:   of multiple transforms, and dealing in some new set of representational
-//:   ideas. Levels will be added in reverse order to the one their transforms
-//:   will be run in.
-//:
-//:     To run all transforms:
-//:       Load transforms for level n
-//:       Load transforms for level n-1
-//:       ...
-//:       Load transforms for level 2
-//:       Run code at level 1
-//:
-//:   b) *Within* a level we'll usually introduce transforms in the order
-//:   they're run in.
-//:
-//:     To run transforms for level n:
-//:       Perform transform of layer l
-//:       Perform transform of layer l+1
-//:       ...
-//:
-//:   c) Within a level it's often most natural to introduce a new
-//:   representation by showing how it's transformed to the level below. To
-//:   make such exceptions more obvious checks usually won't be first-class
-//:   transforms; instead code that keeps the program unmodified will run
-//:   within transforms before they mutate the program.
-//:
-//:     Level l transforms programs
-//:     Level l+1 inserts checks to run *before* the transform of level l runs
-//:
-//: This may all seem abstract, but will hopefully make sense over time. The
-//: goals are basically to always have a working program after any layer, to
-//: have the order of layers make narrative sense, and to order transforms
-//: correctly at runtime.
-:(before "End One-time Setup")
-// Begin Transforms
-// End Transforms
-
 :(code)
 // write out a program to a bare-bones ELF file
 void save_elf(const program& p, const char* filename) {
diff --git a/subx/029transforms.cc b/subx/029transforms.cc
new file mode 100644
index 00000000..9546ea91
--- /dev/null
+++ b/subx/029transforms.cc
@@ -0,0 +1,65 @@
+//: Ordering transforms is a well-known hard problem when building compilers.
+//: In our case we also have the additional notion of layers. The ordering of
+//: layers can have nothing in common with the ordering of transforms when
+//: SubX is tangled and run. This can be confusing for readers, particularly
+//: if later layers start inserting transforms at arbitrary points between
+//: transforms introduced earlier. Over time adding transforms can get harder
+//: and harder, having to meet the constraints of everything that's come
+//: before. It's worth thinking about organization up-front so the ordering is
+//: easy to hold in our heads, and it's obvious where to add a new transform.
+//: Some constraints:
+//:
+//:   1. Layers force us to build SubX bottom-up; since we want to be able to
+//:   build and run SubX after stopping loading at any layer, the overall
+//:   organization has to be to introduce primitives before we start using
+//:   them.
+//:
+//:   2. Transforms usually need to be run top-down, converting high-level
+//:   representations to low-level ones so that low-level layers can be
+//:   oblivious to them.
+//:
+//:   3. When running we'd often like new representations to be checked before
+//:   they are transformed away. The whole reason for new representations is
+//:   often to add new kinds of automatic checking for our machine code
+//:   programs.
+//:
+//: Putting these constraints together, we'll use the following broad
+//: organization:
+//:
+//:   a) We'll divide up our transforms into "levels", each level consisting
+//:   of multiple transforms, and dealing in some new set of representational
+//:   ideas. Levels will be added in reverse order to the one their transforms
+//:   will be run in.
+//:
+//:     To run all transforms:
+//:       Load transforms for level n
+//:       Load transforms for level n-1
+//:       ...
+//:       Load transforms for level 2
+//:       Run code at level 1
+//:
+//:   b) *Within* a level we'll usually introduce transforms in the order
+//:   they're run in.
+//:
+//:     To run transforms for level n:
+//:       Perform transform of layer l
+//:       Perform transform of layer l+1
+//:       ...
+//:
+//:   c) Within a level it's often most natural to introduce a new
+//:   representation by showing how it's transformed to the level below. To
+//:   make such exceptions more obvious checks usually won't be first-class
+//:   transforms; instead code that keeps the program unmodified will run
+//:   within transforms before they mutate the program.
+//:
+//:     Level l transforms programs
+//:     Level l+1 inserts checks to run *before* the transform of level l runs
+//:
+//: This may all seem abstract, but will hopefully make sense over time. The
+//: goals are basically to always have a working program after any layer, to
+//: have the order of layers make narrative sense, and to order transforms
+//: correctly at runtime.
+
+:(before "End One-time Setup")
+// Begin Transforms
+// End Transforms
44 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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098