From 215365d427c73001d83e8e598d9fc15745203f5c Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 28 Nov 2015 22:17:47 -0800 Subject: 2494 Some more structure to transforms, and flattening of dependencies between them. --- 012transform.cc | 8 ++++++++ 013update_operation.cc | 2 +- 021check_instruction.cc | 2 +- 030container.cc | 2 +- 040brace.cc | 2 +- 041jump_target.cc | 2 +- 042name.cc | 2 +- 052tangle.cc | 2 +- 999spaces.cc | 41 ++++++++++++++++++++++++----------------- 9 files changed, 39 insertions(+), 24 deletions(-) diff --git a/012transform.cc b/012transform.cc index ad0d2b73..bbefe0f7 100644 --- a/012transform.cc +++ b/012transform.cc @@ -26,8 +26,16 @@ vector Transform; :(after "int main") // Begin Transforms + // Begin Instruction Inserting/Deleting Transforms + // End Instruction Inserting/Deleting Transforms + + // Begin Instruction Modifying Transforms + // End Instruction Modifying Transforms // End Transforms + // Begin Checks + // End Checks + :(code) void transform_all() { trace(9990, "transform") << "=== transform_all()" << end(); diff --git a/013update_operation.cc b/013update_operation.cc index 77fb44f2..c02a24c5 100644 --- a/013update_operation.cc +++ b/013update_operation.cc @@ -1,7 +1,7 @@ //: Once all code is loaded, save operation ids of instructions and check that //: nothing's undefined. -:(before "End Transforms") +:(before "End Instruction Modifying Transforms") Transform.push_back(update_instruction_operations); // idempotent :(code) diff --git a/021check_instruction.cc b/021check_instruction.cc index 7b177993..79022e2a 100644 --- a/021check_instruction.cc +++ b/021check_instruction.cc @@ -8,7 +8,7 @@ //: sophisticated layer system I'd introduce the simpler version first and //: transform it in a separate layer or set of layers. -:(before "End Transforms") +:(before "End Checks") Transform.push_back(check_instruction); // idempotent :(code) diff --git a/030container.cc b/030container.cc index 0a9f206a..ca95be07 100644 --- a/030container.cc +++ b/030container.cc @@ -527,7 +527,7 @@ container bar [ ] $error: 0 -:(after "Begin Transforms") +:(after "Begin Instruction Modifying Transforms") Transform.push_back(check_or_set_invalid_types); // idempotent :(code) diff --git a/040brace.cc b/040brace.cc index 9fc251c7..007088a3 100644 --- a/040brace.cc +++ b/040brace.cc @@ -31,7 +31,7 @@ recipe main [ +transform: jump 1:offset +transform: copy ... -:(after "Begin Transforms") +:(before "End Instruction Modifying Transforms") Transform.push_back(transform_braces); // idempotent :(code) diff --git a/041jump_target.cc b/041jump_target.cc index 947ab6ba..92a56b8d 100644 --- a/041jump_target.cc +++ b/041jump_target.cc @@ -18,7 +18,7 @@ recipe main [ :(before "End Mu Types Initialization") put(Type_ordinal, "label", 0); -:(after "Begin Transforms") +:(before "End Instruction Modifying Transforms") Transform.push_back(transform_labels); // idempotent :(code) diff --git a/042name.cc b/042name.cc index 8ef2f467..682d89cb 100644 --- a/042name.cc +++ b/042name.cc @@ -18,7 +18,7 @@ recipe main [ +error: main: use before set: y # todo: detect conditional defines -:(after "Transform.push_back(check_or_set_invalid_types") // there'll be other transforms relating to types; they all need to happen first +:(before "End Instruction Modifying Transforms") Transform.push_back(transform_names); // idempotent :(before "End Globals") diff --git a/052tangle.cc b/052tangle.cc index 36284904..efbbbead 100644 --- a/052tangle.cc +++ b/052tangle.cc @@ -54,7 +54,7 @@ else if (command == "after") { //: after all recipes are loaded, insert fragments at appropriate labels. -:(after "Begin Transforms") +:(after "Begin Instruction Inserting/Deleting Transforms") Transform.push_back(insert_fragments); // NOT idempotent //: We might need to perform multiple passes, in case inserted fragments diff --git a/999spaces.cc b/999spaces.cc index 55d0882c..37f4a60f 100644 --- a/999spaces.cc +++ b/999spaces.cc @@ -34,23 +34,30 @@ assert(Max_callstack_depth == 9989); //:: Summary of transforms and their dependencies //: begin transforms -//: 52 insert fragments -//: ↳ 56.2 update header reagents -//: ↓ ↳ 56.4 fill in reply ingredients -//: ↳ 52.2 check fragments +//: begin instruction inserting transforms +//: 52 insert fragments +//: ↳ 56.2 update header reagents +//: ↓ ↳ 56.4 fill in reply ingredients +//: ↳ 52.2 check fragments +//: --- +//: end instruction inserting transforms //: -//: 41 transform labels -//: 40 transform braces +//: begin instruction modifying transforms +//: ↱ 48 check types by name +//: ↑ ↓ ↱ 56.3 deduce types from header +//: ↑ ↓ ↑ ↳ 57 static dispatch +//: ↑ ↳ 56 check reply instructions against header +//: 30 check or set invalid containers +//: --- +//: 13 update instruction operation +//: 40 transform braces +//: 41 transform labels +//: ↱ 46 collect surrounding spaces +//: 42 transform names +//: end instruction modifying transforms //: -//: ↱ 48 check types by name -//: ↑ ↓ ↱ 56.3 deduce types from header -//: ↑ ↓ ↑ ↳ 57 static dispatch -//: ↑ ↳ 56 check reply instructions against header -//: 30 check or set invalid containers -//: ↓ ↱ 46 collect surrounding spaces -//: ↳ 42 transform names -//: --- -//: 13 update inst.operation -//: 21 check inst -//: ↳ 43 transform 'new' to 'allocate' +//: begin checks +//: 21 check instruction +//: ↳ 43 transform 'new' to 'allocate' +//: end checks //: end transforms -- cgit 1.4.1-2-gfad0