diff --git a/README.md b/README.md index 40e9acbe82..fb892e0cea 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Inform 7 -[Version](notes/versioning.md): 10.2.0-beta+6W34 'Krypton' (21 April 2023) +[Version](notes/versioning.md): 10.2.0-beta+6W35 'Krypton' (22 April 2023) ## About Inform diff --git a/build.txt b/build.txt index d59575e006..a39ec3e66d 100644 --- a/build.txt +++ b/build.txt @@ -1,3 +1,3 @@ Prerelease: beta -Build Date: 21 April 2023 -Build Number: 6W34 +Build Date: 22 April 2023 +Build Number: 6W35 diff --git a/docs/final-module/4-i6c2.html b/docs/final-module/4-i6c2.html index e639a68bcb..335f307738 100644 --- a/docs/final-module/4-i6c2.html +++ b/docs/final-module/4-i6c2.html @@ -373,7 +373,7 @@
case PLUS_BIP: WRITE("("); VNODE_1C; WRITE(" + "); VNODE_2C; WRITE(")"); break; case MINUS_BIP: WRITE("("); VNODE_1C; WRITE(" - "); VNODE_2C; WRITE(")"); break; - case UNARYMINUS_BIP: WRITE("(-("); VNODE_1C; WRITE("))"); break; + case UNARYMINUS_BIP: Handle unary minus6.1.1; break; case TIMES_BIP: WRITE("("); VNODE_1C; WRITE("*"); VNODE_2C; WRITE(")"); break; case DIVIDE_BIP: WRITE("("); VNODE_1C; WRITE("/"); VNODE_2C; WRITE(")"); break; case MODULO_BIP: WRITE("("); VNODE_1C; WRITE("%%"); VNODE_2C; WRITE(")"); break; @@ -396,11 +396,31 @@case LOOKUPBYTE_BIP: WRITE("("); VNODE_1C; WRITE("->("); VNODE_2C; WRITE("))"); break; case ALTERNATIVE_BIP: VNODE_1C; WRITE(" or "); VNODE_2C; break; case SEQUENTIAL_BIP: WRITE("("); VNODE_1C; WRITE(","); VNODE_2C; WRITE(")"); break; - case TERNARYSEQUENTIAL_BIP: Generate primitive for ternarysequential6.1.1; break; + case TERNARYSEQUENTIAL_BIP: Generate primitive for ternarysequential6.1.2; break; case RANDOM_BIP: WRITE("random("); VNODE_1C; WRITE(")"); break;
§6.1.1. But the unfortunate !ternarysequential a b c needs some gymnastics. It +
§6.1.1. In general, Inform 6 is able to constant-fold, that is, to evaluate expressions +between constants at compile time: for example, 5+6 will be compiled as 11, +not as code to add 5 to 6. But in just a few contexts, notably as case values +in switch statements, constants won't fold. This in particular affects unary +minus, so that (-(23)) is not syntactically valid as a switch case. So we +omit the brackets for applications of unary minus which are simple enough to +do so. (See Jira bug I7-2304.) +
+ +Handle unary minus6.1.1 = +
+ ++ if (Inode::get_construct_ID(InterTree::first_child(P)) == VAL_IST) { + WRITE("-"); VNODE_1C; + } else { + WRITE("(-("); VNODE_1C; WRITE("))"); + } ++
§6.1.2. But the unfortunate !ternarysequential a b c needs some gymnastics. It would be trivial to generate to C with the serial comma operator: (a, b, c) evaluates a, then throws that away and evaluates b, then throws that away too and returns the value of c. @@ -428,7 +448,7 @@
Generate primitive for ternarysequential6.1.1 = +
Generate primitive for ternarysequential6.1.2 =
diff --git a/inform7/Figures/timings-diagnostics.txt b/inform7/Figures/timings-diagnostics.txt index b657574a7f..3c26590a8c 100644 --- a/inform7/Figures/timings-diagnostics.txt +++ b/inform7/Figures/timings-diagnostics.txt @@ -1,24 +1,24 @@ 100.0% in inform7 run - 70.4% in compilation to Inter - 49.7% in //Sequence::undertake_queued_tasks// + 70.7% in compilation to Inter + 49.8% in //Sequence::undertake_queued_tasks// 4.9% in //MajorNodes::pre_pass// 3.5% in //MajorNodes::pass_1// 1.8% in //ImperativeDefinitions::assess_all// + 1.6% in //RTPhrasebook::compile_entries// 1.4% in //RTKindConstructors::compile// - 1.4% in //RTPhrasebook::compile_entries// 1.0% in //Sequence::lint_inter// 0.6% in //MajorNodes::pass_2// + 0.6% in //Sequence::undertake_queued_tasks// 0.6% in //World::stage_V// 0.4% in //ImperativeDefinitions::compile_first_block// 0.4% in //Sequence::undertake_queued_tasks// - 0.4% in //Sequence::undertake_queued_tasks// 0.2% in //CompletionModule::compile// 0.2% in //InferenceSubjects::emit_all// 0.2% in //RTKindConstructors::compile_permissions// 0.2% in //Task::make_built_in_kind_constructors// - 3.1% not specifically accounted for - 26.0% in running Inter pipeline - 9.9% in step 14/15: generate inform6 -> auto.inf + 2.9% not specifically accounted for + 25.9% in running Inter pipeline + 10.1% in step 14/15: generate inform6 -> auto.inf 5.7% in step 5/15: load-binary-kits 5.3% in step 6/15: make-synoptic-module 1.8% in step 9/15: make-identifiers-unique @@ -27,6 +27,6 @@ 0.4% in step 7/15: shorten-wiring 0.2% in step 11/15: eliminate-redundant-labels 0.2% in step 8/15: detect-indirect-calls - 1.5% not specifically accounted for + 1.2% not specifically accounted for 3.0% in supervisor - 0.5% not specifically accounted for + 0.3% not specifically accounted for diff --git a/inform7/Internal/Inter/BasicInformExtrasKit/kit_metadata.json b/inform7/Internal/Inter/BasicInformExtrasKit/kit_metadata.json index f0eb2d196a..065be95835 100644 --- a/inform7/Internal/Inter/BasicInformExtrasKit/kit_metadata.json +++ b/inform7/Internal/Inter/BasicInformExtrasKit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "BasicInformExtrasKit", - "version": "10.2.0-beta+6W34" + "version": "10.2.0-beta+6W35" }, "kit-details": { "has-priority": 1 diff --git a/inform7/Internal/Inter/BasicInformKit/kit_metadata.json b/inform7/Internal/Inter/BasicInformKit/kit_metadata.json index 46cf342526..132488c335 100644 --- a/inform7/Internal/Inter/BasicInformKit/kit_metadata.json +++ b/inform7/Internal/Inter/BasicInformKit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "BasicInformKit", - "version": "10.2.0-beta+6W34" + "version": "10.2.0-beta+6W35" }, "needs": [ { "unless": { diff --git a/inform7/Internal/Inter/CommandParserKit/kit_metadata.json b/inform7/Internal/Inter/CommandParserKit/kit_metadata.json index 39bb7c8eb0..c3dc033bb9 100644 --- a/inform7/Internal/Inter/CommandParserKit/kit_metadata.json +++ b/inform7/Internal/Inter/CommandParserKit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "CommandParserKit", - "version": "10.2.0-beta+6W34" + "version": "10.2.0-beta+6W35" }, "needs": [ { "need": { diff --git a/inform7/Internal/Inter/EnglishLanguageKit/kit_metadata.json b/inform7/Internal/Inter/EnglishLanguageKit/kit_metadata.json index a952bb0d8d..6dd0e9946b 100644 --- a/inform7/Internal/Inter/EnglishLanguageKit/kit_metadata.json +++ b/inform7/Internal/Inter/EnglishLanguageKit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "EnglishLanguageKit", - "version": "10.2.0-beta+6W34" + "version": "10.2.0-beta+6W35" }, "needs": [ { "need": { diff --git a/inform7/Internal/Inter/WorldModelKit/kit_metadata.json b/inform7/Internal/Inter/WorldModelKit/kit_metadata.json index 904625c7ed..b1fdae91d2 100644 --- a/inform7/Internal/Inter/WorldModelKit/kit_metadata.json +++ b/inform7/Internal/Inter/WorldModelKit/kit_metadata.json @@ -2,7 +2,7 @@ "is": { "type": "kit", "title": "WorldModelKit", - "version": "10.2.0-beta+6W34" + "version": "10.2.0-beta+6W35" }, "needs": [ { "need": { diff --git a/inter/final-module/Chapter 4/Inform 6 Code.w b/inter/final-module/Chapter 4/Inform 6 Code.w index 3913c803b8..839d089d07 100644 --- a/inter/final-module/Chapter 4/Inform 6 Code.w +++ b/inter/final-module/Chapter 4/Inform 6 Code.w @@ -272,7 +272,7 @@ it corresponds directly to the |or| keyword of Inform 6, so generating it is tri @= case PLUS_BIP: WRITE("("); VNODE_1C; WRITE(" + "); VNODE_2C; WRITE(")"); break; case MINUS_BIP: WRITE("("); VNODE_1C; WRITE(" - "); VNODE_2C; WRITE(")"); break; - case UNARYMINUS_BIP: WRITE("(-("); VNODE_1C; WRITE("))"); break; + case UNARYMINUS_BIP: @ ; break; case TIMES_BIP: WRITE("("); VNODE_1C; WRITE("*"); VNODE_2C; WRITE(")"); break; case DIVIDE_BIP: WRITE("("); VNODE_1C; WRITE("/"); VNODE_2C; WRITE(")"); break; case MODULO_BIP: WRITE("("); VNODE_1C; WRITE("%%"); VNODE_2C; WRITE(")"); break; @@ -298,6 +298,21 @@ it corresponds directly to the |or| keyword of Inform 6, so generating it is tri case TERNARYSEQUENTIAL_BIP: @ ; break; case RANDOM_BIP: WRITE("random("); VNODE_1C; WRITE(")"); break; +@ In general, Inform 6 is able to constant-fold, that is, to evaluate expressions +between constants at compile time: for example, |5+6| will be compiled as |11|, +not as code to add |5| to |6|. But in just a few contexts, notably as case values +in |switch| statements, constants won't fold. This in particular affects unary +minus, so that |(-(23))| is not syntactically valid as a switch case. So we +omit the brackets for applications of unary minus which are simple enough to +do so. (See Jira bug I7-2304.) + +@ = + if (Inode::get_construct_ID(InterTree::first_child(P)) == VAL_IST) { + WRITE("-"); VNODE_1C; + } else { + WRITE("(-("); VNODE_1C; WRITE("))"); + } + @ But the unfortunate |!ternarysequential a b c| needs some gymnastics. It would be trivial to generate to C with the serial comma operator: |(a, b, c)| evaluates |a|, then throws that away and evaluates |b|, then throws that away