diff options
-rw-r--r-- | cpp/.traces/break_cascading | 24 | ||||
-rw-r--r-- | cpp/.traces/break_cascading2 | 38 | ||||
-rw-r--r-- | cpp/.traces/break_empty_block | 16 | ||||
-rw-r--r-- | cpp/024brace | 45 |
4 files changed, 123 insertions, 0 deletions
diff --git a/cpp/.traces/break_cascading b/cpp/.traces/break_cascading new file mode 100644 index 00000000..09ba7965 --- /dev/null +++ b/cpp/.traces/break_cascading @@ -0,0 +1,24 @@ +parse/0: instruction: 1 +parse/0: ingredient: {name: "0", value: 0, type: 0, properties: [0: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: label: { +parse/0: instruction: 25 +parse/0: label: } +parse/0: label: { +parse/0: instruction: 25 +parse/0: label: } +brace/0: 24: push (open, 1) +brace/0: push (close, 3) +brace/0: 24: push (open, 4) +brace/0: push (close, 6) +after-brace/0: recipe main +after-brace/0: copy ... +after-brace/0: jump 0:offset +after-brace/0: jump 0:offset +run/0: instruction main/0 +run/0: ingredient 0 is 0 +mem/0: storing in location 1 +run/0: instruction main/2 +run/0: ingredient 0 is +run/0: instruction main/5 +run/0: ingredient 0 is diff --git a/cpp/.traces/break_cascading2 b/cpp/.traces/break_cascading2 new file mode 100644 index 00000000..313c607c --- /dev/null +++ b/cpp/.traces/break_cascading2 @@ -0,0 +1,38 @@ +parse/0: instruction: 1 +parse/0: ingredient: {name: "0", value: 0, type: 0, properties: [0: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: instruction: 1 +parse/0: ingredient: {name: "0", value: 0, type: 0, properties: [0: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: label: { +parse/0: instruction: 25 +parse/0: instruction: 1 +parse/0: ingredient: {name: "0", value: 0, type: 0, properties: [0: literal]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} +parse/0: label: } +parse/0: label: { +parse/0: instruction: 25 +parse/0: label: } +brace/0: 24: push (open, 2) +brace/0: push (close, 5) +brace/0: 24: push (open, 6) +brace/0: push (close, 8) +after-brace/0: recipe main +after-brace/0: copy ... +after-brace/0: copy ... +after-brace/0: jump 1:offset +after-brace/0: copy ... +after-brace/0: jump 0:offset +run/0: instruction main/0 +run/0: ingredient 0 is 0 +mem/0: storing in location 1 +run/0: instruction main/1 +run/0: ingredient 0 is 0 +mem/0: storing in location 2 +run/0: instruction main/3 +run/0: ingredient 0 is +run/0: instruction main/4 +run/0: ingredient 0 is 0 +mem/0: storing in location 3 +run/0: instruction main/7 +run/0: ingredient 0 is diff --git a/cpp/.traces/break_empty_block b/cpp/.traces/break_empty_block new file mode 100644 index 00000000..37e4ced7 --- /dev/null +++ b/cpp/.traces/break_empty_block @@ -0,0 +1,16 @@ +parse/0: instruction: 1 +parse/0: ingredient: {name: "0", value: 0, type: 0, properties: [0: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: label: { +parse/0: instruction: 25 +parse/0: label: } +brace/0: 24: push (open, 1) +brace/0: push (close, 3) +after-brace/0: recipe main +after-brace/0: copy ... +after-brace/0: jump 0:offset +run/0: instruction main/0 +run/0: ingredient 0 is 0 +mem/0: storing in location 1 +run/0: instruction main/2 +run/0: ingredient 0 is diff --git a/cpp/024brace b/cpp/024brace index 72318faa..2402923b 100644 --- a/cpp/024brace +++ b/cpp/024brace @@ -112,3 +112,48 @@ recipe main [ +after-brace: copy ... +after-brace: copy ... +after-brace: jump -2:offset + +:(scenario "break_empty_block") +recipe main [ + 1:integer <- copy 0:literal + { + break + } +] ++after-brace: recipe main ++after-brace: copy ... ++after-brace: jump 0:offset + +:(scenario "break_cascading") +recipe main [ + 1:integer <- copy 0:literal + { + break + } + { + break + } +] ++after-brace: recipe main ++after-brace: copy ... ++after-brace: jump 0:offset ++after-brace: jump 0:offset + +:(scenario "break_cascading2") +recipe main [ + 1:integer <- copy 0:literal + 2:integer <- copy 0:literal + { + break + 3:integer <- copy 0:literal + } + { + break + } +] ++after-brace: recipe main ++after-brace: copy ... ++after-brace: copy ... ++after-brace: jump 1:offset ++after-brace: copy ... ++after-brace: jump 0:offset |