diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-03-16 22:52:04 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-03-16 22:52:04 -0700 |
commit | a4ef18b194a24710847be59554e51a1fd618228d (patch) | |
tree | 2c717ae73346922b4ecdc2ac108ed0cb73da1d79 | |
parent | 100157d1a83ccb02d82af21c5767ecda3d7cb1c2 (diff) | |
download | mu-a4ef18b194a24710847be59554e51a1fd618228d.tar.gz |
940 - c++: some changes to instruction model
60 files changed, 383 insertions, 366 deletions
diff --git a/cpp/.traces/add b/cpp/.traces/add index eaa94f85..c831e62a 100644 --- a/cpp/.traces/add +++ b/cpp/.traces/add @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 2 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 23 mem/0: storing in location 1 diff --git a/cpp/.traces/add_literal b/cpp/.traces/add_literal index e695a9a0..b9879031 100644 --- a/cpp/.traces/add_literal +++ b/cpp/.traces/add_literal @@ -1,7 +1,7 @@ parse/0: instruction: 2 -parse/0: ingredient: {name: "23", type: 0} -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} run/0: instruction main/0 run/0: ingredient 0 is 23 run/0: ingredient 1 is 34 diff --git a/cpp/.traces/and b/cpp/.traces/and index 4bbf11c3..b487c4e4 100644 --- a/cpp/.traces/and +++ b/cpp/.traces/and @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "1", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "0", type: 0} -parse/0: product: {name: "2", type: 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: instruction: 7 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 1 mem/0: storing in location 1 diff --git a/cpp/.traces/calling_recipe b/cpp/.traces/calling_recipe index 3c220e09..e8e3f1f3 100644 --- a/cpp/.traces/calling_recipe +++ b/cpp/.traces/calling_recipe @@ -1,8 +1,8 @@ parse/0: instruction: 25 parse/0: instruction: 2 -parse/0: ingredient: {name: "2", type: 0} -parse/0: ingredient: {name: "2", type: 0} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "2", value: 2, type: 0, properties: [2: literal]} +parse/0: ingredient: {name: "2", value: 2, type: 0, properties: [2: literal]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: instruction f/0 run/0: ingredient 0 is 2 diff --git a/cpp/.traces/copy b/cpp/.traces/copy index 507bf92a..9a52d9d6 100644 --- a/cpp/.traces/copy +++ b/cpp/.traces/copy @@ -1,9 +1,9 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "1", type: 1} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} run/0: instruction main/0 run/0: ingredient 0 is 23 mem/0: storing in location 1 diff --git a/cpp/.traces/copy_array b/cpp/.traces/copy_array index 7350b04e..967a9ed9 100644 --- a/cpp/.traces/copy_array +++ b/cpp/.traces/copy_array @@ -1,18 +1,18 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "3", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "3", value: 3, type: 0, properties: [3: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "14", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "14", value: 14, type: 0, properties: [14: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "15", type: 0} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "15", value: 15, type: 0, properties: [15: literal]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "16", type: 0} -parse/0: product: {name: "4", type: 1} +parse/0: ingredient: {name: "16", value: 16, type: 0, properties: [16: literal]} +parse/0: product: {name: "4", value: 4, type: 1, properties: [4: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "1", type: 6} -parse/0: product: {name: "5", type: 6} +parse/0: ingredient: {name: "1", value: 1, type: 6, properties: [1: integer-array]} +parse/0: product: {name: "5", value: 5, type: 6, properties: [5: integer-array]} run/0: instruction main/0 run/0: ingredient 0 is 3 mem/0: storing in location 1 diff --git a/cpp/.traces/copy_indirect b/cpp/.traces/copy_indirect index 357d1498..e55c5c42 100644 --- a/cpp/.traces/copy_indirect +++ b/cpp/.traces/copy_indirect @@ -1,12 +1,12 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "2", type: 0} -parse/0: product: {name: "1", type: 2-1} +parse/0: ingredient: {name: "2", value: 2, type: 0, properties: [2: literal]} +parse/0: product: {name: "1", value: 1, type: 2-1, properties: [1: address:integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "1", type: 2-1, property: deref:} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 2-1, properties: [1: address:integer, deref: ]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 2 mem/0: storing in location 1 diff --git a/cpp/.traces/copy_literal b/cpp/.traces/copy_literal index 06a6b997..cbb53fbc 100644 --- a/cpp/.traces/copy_literal +++ b/cpp/.traces/copy_literal @@ -1,6 +1,6 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} run/0: instruction main/0 run/0: ingredient 0 is 23 mem/0: storing in location 1 diff --git a/cpp/.traces/copy_multiple_locations b/cpp/.traces/copy_multiple_locations index 4ba0d565..f03d3573 100644 --- a/cpp/.traces/copy_multiple_locations +++ b/cpp/.traces/copy_multiple_locations @@ -1,12 +1,12 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "35", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "35", value: 35, type: 0, properties: [35: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "1", type: 4} -parse/0: product: {name: "3", type: 4} +parse/0: ingredient: {name: "1", value: 1, type: 4, properties: [1: point]} +parse/0: product: {name: "3", value: 3, type: 4, properties: [3: point]} run/0: instruction main/0 run/0: ingredient 0 is 34 mem/0: storing in location 1 diff --git a/cpp/.traces/divide b/cpp/.traces/divide index 4cd49db4..0bfb1741 100644 --- a/cpp/.traces/divide +++ b/cpp/.traces/divide @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "27", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "27", value: 27, type: 0, properties: [27: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "3", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "3", value: 3, type: 0, properties: [3: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 5 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 27 mem/0: storing in location 1 diff --git a/cpp/.traces/divide_literal b/cpp/.traces/divide_literal index 3d29139b..41552683 100644 --- a/cpp/.traces/divide_literal +++ b/cpp/.traces/divide_literal @@ -1,7 +1,7 @@ parse/0: instruction: 5 -parse/0: ingredient: {name: "8", type: 0} -parse/0: ingredient: {name: "2", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "8", value: 8, type: 0, properties: [8: literal]} +parse/0: ingredient: {name: "2", value: 2, type: 0, properties: [2: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} run/0: instruction main/0 run/0: ingredient 0 is 8 run/0: ingredient 1 is 2 diff --git a/cpp/.traces/divide_with_remainder b/cpp/.traces/divide_with_remainder index 62993a82..a9f36a48 100644 --- a/cpp/.traces/divide_with_remainder +++ b/cpp/.traces/divide_with_remainder @@ -1,14 +1,14 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "27", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "27", value: 27, type: 0, properties: [27: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "11", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "11", value: 11, type: 0, properties: [11: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 6 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} -parse/0: product: {name: "4", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} +parse/0: product: {name: "4", value: 4, type: 1, properties: [4: integer]} run/0: instruction main/0 run/0: ingredient 0 is 27 mem/0: storing in location 1 diff --git a/cpp/.traces/divide_with_remainder_literal b/cpp/.traces/divide_with_remainder_literal index bcc2451b..4d3a3784 100644 --- a/cpp/.traces/divide_with_remainder_literal +++ b/cpp/.traces/divide_with_remainder_literal @@ -1,8 +1,8 @@ parse/0: instruction: 6 -parse/0: ingredient: {name: "9", type: 0} -parse/0: ingredient: {name: "2", type: 0} -parse/0: product: {name: "1", type: 1} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "9", value: 9, type: 0, properties: [9: literal]} +parse/0: ingredient: {name: "2", value: 2, type: 0, properties: [2: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} run/0: instruction main/0 run/0: ingredient 0 is 9 run/0: ingredient 1 is 2 diff --git a/cpp/.traces/equal b/cpp/.traces/equal index 9abcdde6..4d445657 100644 --- a/cpp/.traces/equal +++ b/cpp/.traces/equal @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "33", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "33", value: 33, type: 0, properties: [33: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 13 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 34 mem/0: storing in location 1 diff --git a/cpp/.traces/equal2 b/cpp/.traces/equal2 index b1d02785..ce3b54b5 100644 --- a/cpp/.traces/equal2 +++ b/cpp/.traces/equal2 @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 13 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 34 mem/0: storing in location 1 diff --git a/cpp/.traces/first_recipe b/cpp/.traces/first_recipe index d20319d2..2d13cf1d 100644 --- a/cpp/.traces/first_recipe +++ b/cpp/.traces/first_recipe @@ -1,3 +1,3 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} diff --git a/cpp/.traces/get b/cpp/.traces/get index fed4a487..ff2c96b8 100644 --- a/cpp/.traces/get +++ b/cpp/.traces/get @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "12", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "12", value: 12, type: 1, properties: [12: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "35", type: 0} -parse/0: product: {name: "13", type: 1} +parse/0: ingredient: {name: "35", value: 35, type: 0, properties: [35: literal]} +parse/0: product: {name: "13", value: 13, type: 1, properties: [13: integer]} parse/0: instruction: 18 -parse/0: ingredient: {name: "12", type: 4} -parse/0: ingredient: {name: "1", type: 0} -parse/0: product: {name: "15", type: 1} +parse/0: ingredient: {name: "12", value: 12, type: 4, properties: [12: point]} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: offset]} +parse/0: product: {name: "15", value: 15, type: 1, properties: [15: integer]} run/0: instruction main/0 run/0: ingredient 0 is 34 mem/0: storing in location 12 diff --git a/cpp/.traces/get_address b/cpp/.traces/get_address index 59da3a6d..1156f7cd 100644 --- a/cpp/.traces/get_address +++ b/cpp/.traces/get_address @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "12", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "12", value: 12, type: 1, properties: [12: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "35", type: 0} -parse/0: product: {name: "13", type: 1} +parse/0: ingredient: {name: "35", value: 35, type: 0, properties: [35: literal]} +parse/0: product: {name: "13", value: 13, type: 1, properties: [13: integer]} parse/0: instruction: 19 -parse/0: ingredient: {name: "12", type: 4} -parse/0: ingredient: {name: "1", type: 0} -parse/0: product: {name: "15", type: 2-1} +parse/0: ingredient: {name: "12", value: 12, type: 4, properties: [12: point]} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: offset]} +parse/0: product: {name: "15", value: 15, type: 2-1, properties: [15: address:integer]} run/0: instruction main/0 run/0: ingredient 0 is 34 mem/0: storing in location 12 diff --git a/cpp/.traces/get_address_indirect b/cpp/.traces/get_address_indirect index 27591476..16f3f56a 100644 --- a/cpp/.traces/get_address_indirect +++ b/cpp/.traces/get_address_indirect @@ -1,16 +1,16 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "2", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "2", value: 2, type: 0, properties: [2: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "35", type: 0} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "35", value: 35, type: 0, properties: [35: literal]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} parse/0: instruction: 19 -parse/0: ingredient: {name: "1", type: 2-4, property: deref:} -parse/0: ingredient: {name: "0", type: 0} -parse/0: product: {name: "4", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 2-4, properties: [1: address:point, deref: ]} +parse/0: ingredient: {name: "0", value: 0, type: 0, properties: [0: offset]} +parse/0: product: {name: "4", value: 4, type: 1, properties: [4: integer]} run/0: instruction main/0 run/0: ingredient 0 is 2 mem/0: storing in location 1 diff --git a/cpp/.traces/get_handles_record_fields b/cpp/.traces/get_handles_record_fields index 0c1eb7d9..85fdec38 100644 --- a/cpp/.traces/get_handles_record_fields +++ b/cpp/.traces/get_handles_record_fields @@ -1,16 +1,16 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "12", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "12", value: 12, type: 1, properties: [12: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "35", type: 0} -parse/0: product: {name: "13", type: 1} +parse/0: ingredient: {name: "35", value: 35, type: 0, properties: [35: literal]} +parse/0: product: {name: "13", value: 13, type: 1, properties: [13: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "36", type: 0} -parse/0: product: {name: "14", type: 1} +parse/0: ingredient: {name: "36", value: 36, type: 0, properties: [36: literal]} +parse/0: product: {name: "14", value: 14, type: 1, properties: [14: integer]} parse/0: instruction: 18 -parse/0: ingredient: {name: "12", type: 5} -parse/0: ingredient: {name: "1", type: 0} -parse/0: product: {name: "15", type: 1} +parse/0: ingredient: {name: "12", value: 12, type: 5, properties: [12: point-integer]} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: offset]} +parse/0: product: {name: "15", value: 15, type: 1, properties: [15: integer]} run/0: instruction main/0 run/0: ingredient 0 is 34 mem/0: storing in location 12 diff --git a/cpp/.traces/get_indirect b/cpp/.traces/get_indirect index 6aaf660d..a3daab86 100644 --- a/cpp/.traces/get_indirect +++ b/cpp/.traces/get_indirect @@ -1,16 +1,16 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "2", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "2", value: 2, type: 0, properties: [2: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "35", type: 0} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "35", value: 35, type: 0, properties: [35: literal]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} parse/0: instruction: 18 -parse/0: ingredient: {name: "1", type: 2-4, property: deref:} -parse/0: ingredient: {name: "0", type: 0} -parse/0: product: {name: "4", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 2-4, properties: [1: address:point, deref: ]} +parse/0: ingredient: {name: "0", value: 0, type: 0, properties: [0: offset]} +parse/0: product: {name: "4", value: 4, type: 1, properties: [4: integer]} run/0: instruction main/0 run/0: ingredient 0 is 2 mem/0: storing in location 1 diff --git a/cpp/.traces/greater_or_equal b/cpp/.traces/greater_or_equal index d347b751..f9065713 100644 --- a/cpp/.traces/greater_or_equal +++ b/cpp/.traces/greater_or_equal @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "33", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "33", value: 33, type: 0, properties: [33: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 16 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 34 mem/0: storing in location 1 diff --git a/cpp/.traces/greater_or_equal2 b/cpp/.traces/greater_or_equal2 index 4777cecc..00ff6059 100644 --- a/cpp/.traces/greater_or_equal2 +++ b/cpp/.traces/greater_or_equal2 @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 16 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 34 mem/0: storing in location 1 diff --git a/cpp/.traces/greater_or_equal3 b/cpp/.traces/greater_or_equal3 index 4e5986ec..8795fd99 100644 --- a/cpp/.traces/greater_or_equal3 +++ b/cpp/.traces/greater_or_equal3 @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "35", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "35", value: 35, type: 0, properties: [35: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 16 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 34 mem/0: storing in location 1 diff --git a/cpp/.traces/greater_than b/cpp/.traces/greater_than index 58654c92..ce7c3e5c 100644 --- a/cpp/.traces/greater_than +++ b/cpp/.traces/greater_than @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "33", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "33", value: 33, type: 0, properties: [33: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 14 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 34 mem/0: storing in location 1 diff --git a/cpp/.traces/greater_than2 b/cpp/.traces/greater_than2 index cc0494ee..17f6c6fa 100644 --- a/cpp/.traces/greater_than2 +++ b/cpp/.traces/greater_than2 @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 14 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 34 mem/0: storing in location 1 diff --git a/cpp/.traces/index b/cpp/.traces/index index 9809b808..0e60606f 100644 --- a/cpp/.traces/index +++ b/cpp/.traces/index @@ -1,19 +1,19 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "3", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "3", value: 3, type: 0, properties: [3: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "14", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "14", value: 14, type: 0, properties: [14: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "15", type: 0} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "15", value: 15, type: 0, properties: [15: literal]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "16", type: 0} -parse/0: product: {name: "4", type: 1} +parse/0: ingredient: {name: "16", value: 16, type: 0, properties: [16: literal]} +parse/0: product: {name: "4", value: 4, type: 1, properties: [4: integer]} parse/0: instruction: 20 -parse/0: ingredient: {name: "1", type: 6} -parse/0: ingredient: {name: "0", type: 0} -parse/0: product: {name: "5", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 6, properties: [1: integer-array]} +parse/0: ingredient: {name: "0", value: 0, type: 0, properties: [0: literal]} +parse/0: product: {name: "5", value: 5, type: 1, properties: [5: integer]} run/0: instruction main/0 run/0: ingredient 0 is 3 mem/0: storing in location 1 diff --git a/cpp/.traces/index_address b/cpp/.traces/index_address index 76b99827..297fcfc9 100644 --- a/cpp/.traces/index_address +++ b/cpp/.traces/index_address @@ -1,19 +1,19 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "3", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "3", value: 3, type: 0, properties: [3: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "14", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "14", value: 14, type: 0, properties: [14: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "15", type: 0} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "15", value: 15, type: 0, properties: [15: literal]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "16", type: 0} -parse/0: product: {name: "4", type: 1} +parse/0: ingredient: {name: "16", value: 16, type: 0, properties: [16: literal]} +parse/0: product: {name: "4", value: 4, type: 1, properties: [4: integer]} parse/0: instruction: 21 -parse/0: ingredient: {name: "1", type: 6} -parse/0: ingredient: {name: "0", type: 0} -parse/0: product: {name: "5", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 6, properties: [1: integer-array]} +parse/0: ingredient: {name: "0", value: 0, type: 0, properties: [0: literal]} +parse/0: product: {name: "5", value: 5, type: 1, properties: [5: integer]} run/0: instruction main/0 run/0: ingredient 0 is 3 mem/0: storing in location 1 diff --git a/cpp/.traces/jump_backward b/cpp/.traces/jump_backward index 48164312..e592f74c 100644 --- a/cpp/.traces/jump_backward +++ b/cpp/.traces/jump_backward @@ -1,9 +1,9 @@ parse/0: instruction: 10 -parse/0: ingredient: {name: "1", type: 0} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: offset]} parse/0: instruction: 10 -parse/0: ingredient: {name: "1", type: 0} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: offset]} parse/0: instruction: 10 -parse/0: ingredient: {name: "-2", type: 0} +parse/0: ingredient: {name: "-2", value: -2, type: 0, properties: [-2: offset]} run/0: instruction main/0 run/0: ingredient 0 is 1 run/0: instruction main/2 diff --git a/cpp/.traces/jump_can_skip_instructions b/cpp/.traces/jump_can_skip_instructions index b8bc85e9..8372bbdb 100644 --- a/cpp/.traces/jump_can_skip_instructions +++ b/cpp/.traces/jump_can_skip_instructions @@ -1,7 +1,7 @@ parse/0: instruction: 10 -parse/0: ingredient: {name: "1", type: 0} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: offset]} parse/0: instruction: 1 -parse/0: ingredient: {name: "1", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} run/0: instruction main/0 run/0: ingredient 0 is 1 diff --git a/cpp/.traces/jump_if b/cpp/.traces/jump_if index 707dfd81..d126aa33 100644 --- a/cpp/.traces/jump_if +++ b/cpp/.traces/jump_if @@ -1,9 +1,9 @@ parse/0: instruction: 11 -parse/0: ingredient: {name: "999", type: 0} -parse/0: ingredient: {name: "1", type: 0} +parse/0: ingredient: {name: "999", value: 999, type: 0, properties: [999: literal]} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: offset]} parse/0: instruction: 1 -parse/0: ingredient: {name: "1", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} run/0: instruction main/0 run/0: ingredient 0 is 999 run/0: ingredient 1 is 1 diff --git a/cpp/.traces/jump_if_fallthrough b/cpp/.traces/jump_if_fallthrough index f95c99bb..056b67d8 100644 --- a/cpp/.traces/jump_if_fallthrough +++ b/cpp/.traces/jump_if_fallthrough @@ -1,9 +1,9 @@ parse/0: instruction: 11 -parse/0: ingredient: {name: "0", type: 0} -parse/0: ingredient: {name: "1", type: 0} +parse/0: ingredient: {name: "0", value: 0, type: 0, properties: [0: literal]} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: offset]} parse/0: instruction: 1 -parse/0: ingredient: {name: "1", type: 0} -parse/0: product: {name: "123", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: literal]} +parse/0: product: {name: "123", value: 123, type: 1, properties: [123: integer]} run/0: instruction main/0 run/0: ingredient 0 is 0 run/0: jump-if fell through diff --git a/cpp/.traces/jump_unless b/cpp/.traces/jump_unless index a0978ed4..d294faa3 100644 --- a/cpp/.traces/jump_unless +++ b/cpp/.traces/jump_unless @@ -1,9 +1,9 @@ parse/0: instruction: 12 -parse/0: ingredient: {name: "0", type: 0} -parse/0: ingredient: {name: "1", type: 0} +parse/0: ingredient: {name: "0", value: 0, type: 0, properties: [0: literal]} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: offset]} parse/0: instruction: 1 -parse/0: ingredient: {name: "1", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} run/0: instruction main/0 run/0: ingredient 0 is 0 run/0: ingredient 1 is 1 diff --git a/cpp/.traces/jump_unless_fallthrough b/cpp/.traces/jump_unless_fallthrough index c1981cd7..59e87f18 100644 --- a/cpp/.traces/jump_unless_fallthrough +++ b/cpp/.traces/jump_unless_fallthrough @@ -1,9 +1,9 @@ parse/0: instruction: 12 -parse/0: ingredient: {name: "999", type: 0} -parse/0: ingredient: {name: "1", type: 0} +parse/0: ingredient: {name: "999", value: 999, type: 0, properties: [999: literal]} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: offset]} parse/0: instruction: 1 -parse/0: ingredient: {name: "1", type: 0} -parse/0: product: {name: "123", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: literal]} +parse/0: product: {name: "123", value: 123, type: 1, properties: [123: integer]} run/0: instruction main/0 run/0: ingredient 0 is 999 run/0: jump-unless fell through diff --git a/cpp/.traces/lesser_or_equal b/cpp/.traces/lesser_or_equal index cfd78e25..aadc8a0c 100644 --- a/cpp/.traces/lesser_or_equal +++ b/cpp/.traces/lesser_or_equal @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "32", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "32", value: 32, type: 0, properties: [32: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "33", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "33", value: 33, type: 0, properties: [33: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 17 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 32 mem/0: storing in location 1 diff --git a/cpp/.traces/lesser_or_equal2 b/cpp/.traces/lesser_or_equal2 index 02874d2f..1beafca9 100644 --- a/cpp/.traces/lesser_or_equal2 +++ b/cpp/.traces/lesser_or_equal2 @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "33", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "33", value: 33, type: 0, properties: [33: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "33", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "33", value: 33, type: 0, properties: [33: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 17 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 33 mem/0: storing in location 1 diff --git a/cpp/.traces/lesser_or_equal3 b/cpp/.traces/lesser_or_equal3 index cc6828fc..9dcb4092 100644 --- a/cpp/.traces/lesser_or_equal3 +++ b/cpp/.traces/lesser_or_equal3 @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "33", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "33", value: 33, type: 0, properties: [33: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 17 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 34 mem/0: storing in location 1 diff --git a/cpp/.traces/lesser_than b/cpp/.traces/lesser_than index d1d02a6d..2b7b2763 100644 --- a/cpp/.traces/lesser_than +++ b/cpp/.traces/lesser_than @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "32", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "32", value: 32, type: 0, properties: [32: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "33", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "33", value: 33, type: 0, properties: [33: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 15 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 32 mem/0: storing in location 1 diff --git a/cpp/.traces/lesser_than2 b/cpp/.traces/lesser_than2 index f0a593f5..6ee339a9 100644 --- a/cpp/.traces/lesser_than2 +++ b/cpp/.traces/lesser_than2 @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "33", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "33", value: 33, type: 0, properties: [33: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 15 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 34 mem/0: storing in location 1 diff --git a/cpp/.traces/multiply b/cpp/.traces/multiply index d73c18ae..24ad673f 100644 --- a/cpp/.traces/multiply +++ b/cpp/.traces/multiply @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "4", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "4", value: 4, type: 0, properties: [4: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "6", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "6", value: 6, type: 0, properties: [6: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 4 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 4 mem/0: storing in location 1 diff --git a/cpp/.traces/multiply_literal b/cpp/.traces/multiply_literal index 25449167..c190e1ef 100644 --- a/cpp/.traces/multiply_literal +++ b/cpp/.traces/multiply_literal @@ -1,7 +1,7 @@ parse/0: instruction: 4 -parse/0: ingredient: {name: "2", type: 0} -parse/0: ingredient: {name: "3", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "2", value: 2, type: 0, properties: [2: literal]} +parse/0: ingredient: {name: "3", value: 3, type: 0, properties: [3: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} run/0: instruction main/0 run/0: ingredient 0 is 2 run/0: ingredient 1 is 3 diff --git a/cpp/.traces/next_ingredient b/cpp/.traces/next_ingredient index 8ded3d51..ac0de44c 100644 --- a/cpp/.traces/next_ingredient +++ b/cpp/.traces/next_ingredient @@ -1,11 +1,11 @@ parse/0: instruction: 25 -parse/0: ingredient: {name: "2", type: 0} +parse/0: ingredient: {name: "2", value: 2, type: 0, properties: [2: literal]} parse/0: instruction: 22 -parse/0: product: {name: "12", type: 1} +parse/0: product: {name: "12", value: 12, type: 1, properties: [12: integer]} parse/0: instruction: 2 -parse/0: ingredient: {name: "1", type: 0} -parse/0: ingredient: {name: "12", type: 1} -parse/0: product: {name: "13", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: literal]} +parse/0: ingredient: {name: "12", value: 12, type: 1, properties: [12: integer]} +parse/0: product: {name: "13", value: 13, type: 1, properties: [13: integer]} run/0: instruction main/0 run/0: instruction f/0 run/0: product 0 is 2 diff --git a/cpp/.traces/not b/cpp/.traces/not index 30f2b4b9..a5196acc 100644 --- a/cpp/.traces/not +++ b/cpp/.traces/not @@ -1,9 +1,9 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "1", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 9 -parse/0: ingredient: {name: "1", type: 1} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} run/0: instruction main/0 run/0: ingredient 0 is 1 mem/0: storing in location 1 diff --git a/cpp/.traces/or b/cpp/.traces/or index 3f266ea0..b9b9c0cf 100644 --- a/cpp/.traces/or +++ b/cpp/.traces/or @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "1", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "0", type: 0} -parse/0: product: {name: "2", type: 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: instruction: 8 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 1 mem/0: storing in location 1 diff --git a/cpp/.traces/parse_comment_after_instruction b/cpp/.traces/parse_comment_after_instruction index d20319d2..2d13cf1d 100644 --- a/cpp/.traces/parse_comment_after_instruction +++ b/cpp/.traces/parse_comment_after_instruction @@ -1,3 +1,3 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} diff --git a/cpp/.traces/parse_comment_amongst_instruction b/cpp/.traces/parse_comment_amongst_instruction index d20319d2..2d13cf1d 100644 --- a/cpp/.traces/parse_comment_amongst_instruction +++ b/cpp/.traces/parse_comment_amongst_instruction @@ -1,3 +1,3 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} diff --git a/cpp/.traces/parse_comment_amongst_instruction2 b/cpp/.traces/parse_comment_amongst_instruction2 index d20319d2..2d13cf1d 100644 --- a/cpp/.traces/parse_comment_amongst_instruction2 +++ b/cpp/.traces/parse_comment_amongst_instruction2 @@ -1,3 +1,3 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} diff --git a/cpp/.traces/parse_comment_amongst_instruction3 b/cpp/.traces/parse_comment_amongst_instruction3 index 7b755615..6f7f2dce 100644 --- a/cpp/.traces/parse_comment_amongst_instruction3 +++ b/cpp/.traces/parse_comment_amongst_instruction3 @@ -1,6 +1,6 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} diff --git a/cpp/.traces/parse_comment_outside_recipe b/cpp/.traces/parse_comment_outside_recipe index d20319d2..2d13cf1d 100644 --- a/cpp/.traces/parse_comment_outside_recipe +++ b/cpp/.traces/parse_comment_outside_recipe @@ -1,3 +1,3 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} diff --git a/cpp/.traces/parse_multiple_ingredients b/cpp/.traces/parse_multiple_ingredients index ee0c09ba..e40fb659 100644 --- a/cpp/.traces/parse_multiple_ingredients +++ b/cpp/.traces/parse_multiple_ingredients @@ -1,5 +1,5 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: ingredient: {name: "4", type: 1} -parse/0: product: {name: "1", type: 1} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: ingredient: {name: "4", value: 4, type: 1, properties: [4: integer]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} diff --git a/cpp/.traces/parse_multiple_products b/cpp/.traces/parse_multiple_products index f8d5050e..47be43c4 100644 --- a/cpp/.traces/parse_multiple_products +++ b/cpp/.traces/parse_multiple_products @@ -1,4 +1,4 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: product: {name: "1", type: 1} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} diff --git a/cpp/.traces/parse_multiple_types b/cpp/.traces/parse_multiple_types index 319aad1f..1b6903cd 100644 --- a/cpp/.traces/parse_multiple_types +++ b/cpp/.traces/parse_multiple_types @@ -1,5 +1,5 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: ingredient: {name: "4", type: 1} -parse/0: product: {name: "1", type: 1} -parse/0: product: {name: "2", type: 2-1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: ingredient: {name: "4", value: 4, type: 1, properties: [4: integer]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: product: {name: "2", value: 2, type: 2-1, properties: [2: address:integer]} diff --git a/cpp/.traces/parse_properties b/cpp/.traces/parse_properties index c8c059b4..01bfb40a 100644 --- a/cpp/.traces/parse_properties +++ b/cpp/.traces/parse_properties @@ -1,3 +1,3 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: product: {name: "1", type: 1-2, property: deref:} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: product: {name: "1", value: 1, type: 1-2, properties: [1: integer:address, deref: ]} diff --git a/cpp/.traces/reply b/cpp/.traces/reply index 6b7b7417..170c4dcf 100644 --- a/cpp/.traces/reply +++ b/cpp/.traces/reply @@ -1,16 +1,16 @@ parse/0: instruction: 25 -parse/0: ingredient: {name: "2", type: 0} -parse/0: product: {name: "3", type: 1} -parse/0: product: {name: "4", type: 1} +parse/0: ingredient: {name: "2", value: 2, type: 0, properties: [2: literal]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} +parse/0: product: {name: "4", value: 4, type: 1, properties: [4: integer]} parse/0: instruction: 22 -parse/0: product: {name: "12", type: 1} +parse/0: product: {name: "12", value: 12, type: 1, properties: [12: integer]} parse/0: instruction: 2 -parse/0: ingredient: {name: "1", type: 0} -parse/0: ingredient: {name: "12", type: 1} -parse/0: product: {name: "13", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 0, properties: [1: literal]} +parse/0: ingredient: {name: "12", value: 12, type: 1, properties: [12: integer]} +parse/0: product: {name: "13", value: 13, type: 1, properties: [13: integer]} parse/0: instruction: 23 -parse/0: ingredient: {name: "12", type: 1} -parse/0: ingredient: {name: "13", type: 1} +parse/0: ingredient: {name: "12", value: 12, type: 1, properties: [12: integer]} +parse/0: ingredient: {name: "13", value: 13, type: 1, properties: [13: integer]} run/0: instruction main/0 run/0: instruction f/0 run/0: product 0 is 2 diff --git a/cpp/.traces/store_indirect b/cpp/.traces/store_indirect index da8f4aff..97ba5164 100644 --- a/cpp/.traces/store_indirect +++ b/cpp/.traces/store_indirect @@ -1,9 +1,9 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "2", type: 0} -parse/0: product: {name: "1", type: 2-1} +parse/0: ingredient: {name: "2", value: 2, type: 0, properties: [2: literal]} +parse/0: product: {name: "1", value: 1, type: 2-1, properties: [1: address:integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "1", type: 2-1, property: deref:} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "1", value: 1, type: 2-1, properties: [1: address:integer, deref: ]} run/0: instruction main/0 run/0: ingredient 0 is 2 mem/0: storing in location 1 diff --git a/cpp/.traces/subtract b/cpp/.traces/subtract index 72497a6e..5f1a946a 100644 --- a/cpp/.traces/subtract +++ b/cpp/.traces/subtract @@ -1,13 +1,13 @@ parse/0: instruction: 1 -parse/0: ingredient: {name: "23", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} parse/0: instruction: 1 -parse/0: ingredient: {name: "34", type: 0} -parse/0: product: {name: "2", type: 1} +parse/0: ingredient: {name: "34", value: 34, type: 0, properties: [34: literal]} +parse/0: product: {name: "2", value: 2, type: 1, properties: [2: integer]} parse/0: instruction: 3 -parse/0: ingredient: {name: "1", type: 1} -parse/0: ingredient: {name: "2", type: 1} -parse/0: product: {name: "3", type: 1} +parse/0: ingredient: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse/0: ingredient: {name: "2", value: 2, type: 1, properties: [2: integer]} +parse/0: product: {name: "3", value: 3, type: 1, properties: [3: integer]} run/0: instruction main/0 run/0: ingredient 0 is 23 mem/0: storing in location 1 diff --git a/cpp/.traces/subtract_literal b/cpp/.traces/subtract_literal index c4981839..48c3866a 100644 --- a/cpp/.traces/subtract_literal +++ b/cpp/.traces/subtract_literal @@ -1,7 +1,7 @@ parse/0: instruction: 3 -parse/0: ingredient: {name: "5", type: 0} -parse/0: ingredient: {name: "2", type: 0} -parse/0: product: {name: "1", type: 1} +parse/0: ingredient: {name: "5", value: 5, type: 0, properties: [5: literal]} +parse/0: ingredient: {name: "2", value: 2, type: 0, properties: [2: literal]} +parse/0: product: {name: "1", value: 1, type: 1, properties: [1: integer]} run/0: instruction main/0 run/0: ingredient 0 is 5 run/0: ingredient 1 is 2 diff --git a/cpp/010vm b/cpp/010vm index a8dd451a..870df1e4 100644 --- a/cpp/010vm +++ b/cpp/010vm @@ -24,7 +24,8 @@ struct recipe { struct instruction { bool is_label; string label; // only if is_label - recipe_number operation; // only if !is_label + string name; // only if !is_label + recipe_number operation; // Recipe_number[name] vector<reagent> ingredients; // only if !is_label vector<reagent> products; // only if !is_label instruction(); @@ -37,9 +38,10 @@ struct instruction { // us how to interpret them. They also can contain arbitrary other lists of // properties besides types, but we're getting ahead of ourselves. struct reagent { + vector<pair<string, vector<string> > > properties; string name; + int value; vector<type_number> types; - vector<pair<string, property> > properties; reagent(string s); reagent(type_number t); string to_string(); @@ -74,6 +76,7 @@ int Next_type_number = 1; void setup_types() { Type.clear(); Type_number.clear(); Type_number["literal"] = 0; + Type_number["offset"] = 0; Next_type_number = 1; // Mu Types Initialization. int integer = Type_number["integer"] = Next_type_number++; @@ -138,16 +141,20 @@ void setup_recipes() { // Reagents have the form <name>:<type>:<type>:.../<property>/<property>/... reagent::reagent(string s) { istringstream in(s); - name = slurp_until(in, ':'); - istringstream ts(slurp_until(in, '/')); - string t; - while (!(t = slurp_until(ts, ':')).empty()) - types.push_back(Type_number[t]); // properties while (!in.eof()) { - istringstream prop(slurp_until(in, '/')); - string name = slurp_until(prop, ':'); - properties.push_back(pair<string, property>(name, property())); + istringstream row(slurp_until(in, '/')); + string name = slurp_until(row, ':'); + vector<string> values; + while (!row.eof()) + values.push_back(slurp_until(row, ':')); + properties.push_back(pair<string, vector<string> >(name, values)); + } + // structures for the first row of properties + name = properties[0].first; + value = to_int(name); + for (size_t i = 0; i < properties[0].second.size(); ++i) { + types.push_back(Type_number[properties[0].second[i]]); } } reagent::reagent(type_number t) { @@ -155,19 +162,21 @@ void setup_recipes() { } string reagent::to_string() { ostringstream out; - out << "{name: \"" << name << "\", type: "; + out << "{name: \"" << name << "\", value: " << value << ", type: "; for (size_t i = 0; i < types.size(); ++i) { out << types[i]; if (i < types.size()-1) out << "-"; } if (!properties.empty()) { - out << ", property: "; + out << ", properties: ["; for (size_t i = 0; i < properties.size(); ++i) { - out << properties[i].first << ":"; - for (size_t j = 0; j < properties[i].second.values.size(); ++j) { - out << properties[i].second.values[j]; - if (j < properties[i].second.values.size()-1) out << ":"; + out << properties[i].first << ": "; + for (size_t j = 0; j < properties[i].second.size(); ++j) { + out << properties[i].second[j]; + if (j < properties[i].second.size()-1) out << ":"; } + if (i < properties.size()-1) out << ", "; + else out << "]"; } } out << "}"; @@ -192,3 +201,10 @@ void dump_memory() { cout << p->first << ": " << p->second << '\n'; } } + +int to_int(string n) { + char* end = NULL; + int result = strtol(n.c_str(), &end, /*any base*/0); + assert(*end == '\0'); + return result; +} diff --git a/cpp/011load b/cpp/011load index d01c72d2..3d75c9ac 100644 --- a/cpp/011load +++ b/cpp/011load @@ -5,8 +5,8 @@ recipe main [ 1:integer <- copy 23:literal ] +parse: instruction: 1 -+parse: ingredient: {name: "23", type: 0} -+parse: product: {name: "1", type: 1} ++parse: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} ++parse: product: {name: "1", value: 1, type: 1, properties: [1: integer]} :(code) vector<recipe_number> add_recipes(string form) { @@ -165,8 +165,8 @@ recipe main [ 1:integer <- copy 23:literal ] +parse: instruction: 1 -+parse: ingredient: {name: "23", type: 0} -+parse: product: {name: "1", type: 1} ++parse: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} ++parse: product: {name: "1", value: 1, type: 1, properties: [1: integer]} :(scenario parse_comment_amongst_instruction) recipe main [ @@ -174,8 +174,8 @@ recipe main [ 1:integer <- copy 23:literal ] +parse: instruction: 1 -+parse: ingredient: {name: "23", type: 0} -+parse: product: {name: "1", type: 1} ++parse: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} ++parse: product: {name: "1", value: 1, type: 1, properties: [1: integer]} :(scenario parse_comment_amongst_instruction2) recipe main [ @@ -184,8 +184,8 @@ recipe main [ # comment ] +parse: instruction: 1 -+parse: ingredient: {name: "23", type: 0} -+parse: product: {name: "1", type: 1} ++parse: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} ++parse: product: {name: "1", value: 1, type: 1, properties: [1: integer]} :(scenario parse_comment_amongst_instruction3) recipe main [ @@ -194,19 +194,19 @@ recipe main [ 2:integer <- copy 23:literal ] +parse: instruction: 1 -+parse: ingredient: {name: "23", type: 0} -+parse: product: {name: "1", type: 1} ++parse: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} ++parse: product: {name: "1", value: 1, type: 1, properties: [1: integer]} +parse: instruction: 1 -+parse: ingredient: {name: "23", type: 0} -+parse: product: {name: "2", type: 1} ++parse: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} ++parse: product: {name: "2", value: 2, type: 1, properties: [2: integer]} :(scenario parse_comment_after_instruction) recipe main [ 1:integer <- copy 23:literal # comment ] +parse: instruction: 1 -+parse: ingredient: {name: "23", type: 0} -+parse: product: {name: "1", type: 1} ++parse: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} ++parse: product: {name: "1", value: 1, type: 1, properties: [1: integer]} :(scenario parse_label) recipe main [ @@ -215,37 +215,45 @@ recipe main [ +parse: label: +foo -parse: instruction: 1 +:(scenario parse_multiple_properties) +recipe main [ + 1:integer <- copy 23:literal/foo:bar:baz +] ++parse: instruction: 1 ++parse: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal, foo: bar:baz]} ++parse: product: {name: "1", value: 1, type: 1, properties: [1: integer]} + :(scenario parse_multiple_products) recipe main [ 1:integer, 2:integer <- copy 23:literal ] +parse: instruction: 1 -+parse: ingredient: {name: "23", type: 0} -+parse: product: {name: "1", type: 1} -+parse: product: {name: "2", type: 1} ++parse: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} ++parse: product: {name: "1", value: 1, type: 1, properties: [1: integer]} ++parse: product: {name: "2", value: 2, type: 1, properties: [2: integer]} :(scenario parse_multiple_ingredients) recipe main [ 1:integer, 2:integer <- copy 23:literal, 4:integer ] +parse: instruction: 1 -+parse: ingredient: {name: "23", type: 0} -+parse: ingredient: {name: "4", type: 1} -+parse: product: {name: "1", type: 1} -+parse: product: {name: "2", type: 1} ++parse: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} ++parse: ingredient: {name: "4", value: 4, type: 1, properties: [4: integer]} ++parse: product: {name: "1", value: 1, type: 1, properties: [1: integer]} ++parse: product: {name: "2", value: 2, type: 1, properties: [2: integer]} :(scenario parse_multiple_types) recipe main [ 1:integer, 2:address:integer <- copy 23:literal, 4:integer ] +parse: instruction: 1 -+parse: ingredient: {name: "23", type: 0} -+parse: ingredient: {name: "4", type: 1} -+parse: product: {name: "1", type: 1} -+parse: product: {name: "2", type: 2-1} ++parse: ingredient: {name: "23", value: 23, type: 0, properties: [23: literal]} ++parse: ingredient: {name: "4", value: 4, type: 1, properties: [4: integer]} ++parse: product: {name: "1", value: 1, type: 1, properties: [1: integer]} ++parse: product: {name: "2", value: 2, type: 2-1, properties: [2: address:integer]} :(scenario parse_properties) recipe main [ 1:integer:address/deref <- copy 23:literal ] -+parse: product: {name: "1", type: 1-2, property: deref:} ++parse: product: {name: "1", value: 1, type: 1-2, properties: [1: integer:address, deref: ]} diff --git a/cpp/012run b/cpp/012run index bb084b39..8ae164c3 100644 --- a/cpp/012run +++ b/cpp/012run @@ -112,10 +112,10 @@ vector<int> read_memory(reagent x) { //? cout << "read_memory: " << x.to_string() << '\n'; //? 1 vector<int> result; if (x.types[0] == 0) { // literal - result.push_back(to_int(x.name)); + result.push_back(x.value); return result; } - int base = to_int(x.name); + int base = x.value; for (size_t offset = 0; offset < Type[x.types[0]].size; ++offset) { int val = Memory[base+offset]; trace("mem") << "location " << base+offset << " is " << val; @@ -135,13 +135,6 @@ void write_memory(reagent x, vector<int> data) { } :(code) -int to_int(string n) { - char* end = NULL; - int result = strtol(n.c_str(), &end, /*any base*/0); - assert(*end == '\0'); - return result; -} - size_t size_of(reagent r) { type_info t = Type[r.types[0]]; if (!t.is_record && !t.is_array) return t.size; |