Skip to content

Commit 3ea987a

Browse files
committed
Seed7 release 2025-03-25
1 parent 323380c commit 3ea987a

File tree

8 files changed

+702
-231
lines changed

8 files changed

+702
-231
lines changed

doc/chlog.txt

+368-3
Large diffs are not rendered by default.

doc/faq.htm

+66-14
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,9 @@ <h2>
367367
<li><a class="link" href="#faq_indexed_from_one"><b>
368368
Why are strings indexed from one?
369369
</b></a></li>
370+
<li><a class="link" href="#faq_minimum_array_index"><b>
371+
Are arrays indexed from one?
372+
</b></a></li>
370373
<li><a class="link" href="#faq_comparisons"><b>
371374
How are comparisons done in Seed7?
372375
</b></a></li>
@@ -889,12 +892,12 @@ <h2>
889892
</h3></a><hr />
890893
<p>
891894
The Seed7 package contains more than 100000 lines of C and more
892-
than 400000 lines of Seed7. For version 2025-01-11 the number of lines is:
895+
than 400000 lines of Seed7. For version 2025-03-25 the number of lines is:
893896
</p><dl><dd><table border="0" cellspacing="0">
894-
<tr><td align="right">184871</td> <td width="20"></td> <td>C source files (*.c)</td></tr>
895-
<tr><td align="right"> 13806</td> <td width="20"></td> <td>C header files (*.h)</td></tr>
896-
<tr><td align="right">267373</td> <td width="20"></td> <td>Seed7 source files (*.sd7)</td></tr>
897-
<tr><td align="right">197752</td> <td width="20"></td> <td>Seed7 library/include files (*.s7i)</td></tr>
897+
<tr><td align="right">188316</td> <td width="20"></td> <td>C source files (*.c)</td></tr>
898+
<tr><td align="right"> 14009</td> <td width="20"></td> <td>C header files (*.h)</td></tr>
899+
<tr><td align="right">272719</td> <td width="20"></td> <td>Seed7 source files (*.sd7)</td></tr>
900+
<tr><td align="right">198222</td> <td width="20"></td> <td>Seed7 library/include files (*.s7i)</td></tr>
898901
</table></dd></dl><p>
899902
C code (*.c and *.h files) can be divided into the following areas:
900903
</p><dl><dd><table border="0" cellspacing="0">
@@ -1805,7 +1808,10 @@ <h2>
18051808
type annotations are optional they are not considered when the program is
18061809
written, but at a later time (maybe by someone else). If the type annotations
18071810
are not 100% correct unnecessary conversions might take place, which slow
1808-
down the program.
1811+
down the program. Python has type annotations and this would allow writing
1812+
performance critical code in Python instead of C/C++. But in practice the
1813+
type annotations of Python did not lead to a situation where C/C++ code is
1814+
not needed.
18091815
</p></div>
18101816

18111817
<div><br /><a name="faq_first_class_types_and_type_checking"><h3>How can static type checking work if types are first-class objects?
@@ -1877,7 +1883,7 @@ <h2>
18771883
</pre><p>
18781884
triggers the error:
18791885
</p><pre class="indent">
1880-
*** tst249.sd7(6):52: <span class="link">Match for {var intArrayType : {arr } is {[ ] {1 , 2 } } } failed</span>
1886+
*** tst249.sd7(6):57: <span class="link">Match for {var intArrayType : {arr } is {[ ] {1 , 2 } } } failed</span>
18811887
var intArrayType: arr is [](1, 2);
18821888
</pre><p>
18831889
A <tt><span class="keywd">local</span></tt> declaration block is parsed completely before it is executed.
@@ -1907,7 +1913,7 @@ <h2>
19071913
</pre><p>
19081914
triggers the error:
19091915
</p><pre class="indent">
1910-
*** tst309.sd7(4):52: <span class="link">Match for {func result var func type: <BLOCKOBJECT> ({array type: <TYPEOBJECT> ({array string }) }) : {data } is {0 times {0 times "" } } begin {data := {3 times {2 times value } } } end func } failed</span>
1916+
*** tst309.sd7(4):57: <span class="link">Match for {func result var func type: <BLOCKOBJECT> ({array type: <TYPEOBJECT> ({array string }) }) : {data } is {0 times {0 times "" } } begin {data := {3 times {2 times value } } } end func } failed</span>
19111917
const func array array string: test (in string: value) is func
19121918
</pre><p>
19131919
The reason is: The two occurrences of <tt><span class="type">array</span> <span class="type">array</span> <span class="type">string</span></tt> are considered
@@ -2070,10 +2076,10 @@ <h2>
20702076
</pre><p>
20712077
This overloading of the result type triggers compile-time errors:
20722078
</p><pre class="indent">
2073-
*** tst508.sd7(4):34: <a name="faq_OBJTWICEDECLARED_example"></a><span class="link">Redeclaration of "f (val char: x)"</span>
2079+
*** tst508.sd7(4):43: <a name="faq_OBJTWICEDECLARED_example"></a><span class="link">Redeclaration of "f (val char: x)"</span>
20742080
const func string: f (in char: x) is return str(x);
20752081
----------------------------------------------------^
2076-
*** tst508.sd7(3):35: <a name="faq_PREVIOUS_DECLARATION_example"></a><span class="link">Previous declaration of "f (val char: x)"</span>
2082+
*** tst508.sd7(3):44: <a name="faq_PREVIOUS_DECLARATION_example"></a><span class="link">Previous declaration of "f (val char: x)"</span>
20772083
const func integer: f (in char: x) is return ord(x);
20782084
</pre><p>
20792085
Assume return type overloading would be allowed. In this case the expression
@@ -2156,7 +2162,7 @@ <h2>
21562162
A variable declaration with <tt><span class="op">:=</span></tt> would need a different syntax definition.
21572163
An attempt to define this new syntax leads to an error:
21582164
</p><pre class="indent">
2159-
*** tst356.sd7(3):42: <a name="faq_FALSE_INFIX_PRIORITY_example"></a><span class="link">":=" redeclared with infix priority 127 not 20</span>
2165+
*** tst356.sd7(3):52: <a name="faq_REDECLARED_INFIX_PRIORITY_example"></a><span class="link">":=" redeclared with infix priority 127 not 20</span>
21602166
syntax expr: .var.(). : .(expr). := .(expr) is -> 40;
21612167
---------------------------------------------------------^
21622168
</pre><p>
@@ -2190,14 +2196,14 @@ <h2>
21902196
Since the syntax pattern would expect a <tt><span class="op">:=</span></tt> after <tt>number <span class="op">:=</span> 42;</tt> this
21912197
would lead to the error:
21922198
</p><pre class="indent">
2193-
*** tst356.sd7(8):47: <a name="faq_EXPECTED_SYMBOL_example"></a><span class="link">":=" expected found "begin"</span>
2199+
*** tst356.sd7(8):40: <a name="faq_EXPECTED_SYMBOL_example"></a><span class="link">":=" expected found "begin"</span>
21942200
begin
21952201
-------^
21962202
</pre><p>
21972203
To avoid this misinterpretation, the syntax of a variable declaration
21982204
with <tt><span class="op">:=</span></tt> is rejected beforehand with:
21992205
</p><pre class="indent">
2200-
*** tst356.sd7(3):42: <span class="link">":=" redeclared with infix priority 127 not 20</span>
2206+
*** tst356.sd7(3):52: <span class="link">":=" redeclared with infix priority 127 not 20</span>
22012207
</pre><p>
22022208
Languages with hard-coded syntax analysis use a trick to allow the same
22032209
symbol for assignments and initialization. They read the parameter
@@ -2405,6 +2411,52 @@ <h2>
24052411
zero has been introduced.
24062412
</p></div>
24072413

2414+
<div><br /><a name="faq_minimum_array_index"><h3>Are arrays indexed from one?
2415+
</h3></a><hr />
2416+
<p>
2417+
You can set the minimum index of an array. Standard <tt><span class="type">array</span></tt> types like
2418+
<tt><span class="type">array</span> <span class="type">integer</span></tt> do not define a minimum index or the size of the array.
2419+
Instead of being defined by the type the minimum index and the size are
2420+
part of the array value. For an <tt><span class="type">array</span> <span class="type">integer</span></tt> the minimum index could be
2421+
0, 1, 1000 or even -3. An <tt><span class="type">array</span> <span class="type">integer</span></tt> consisting of 5 elements, each
2422+
with the value 123, is created with:
2423+
</p><pre class="indent">
2424+
5 <span class="op">times</span> 123
2425+
</pre><p>
2426+
In this case the minimum index is 1. The same array with a minimum index
2427+
of 0 is created with:
2428+
</p><pre class="indent">
2429+
[0 .. 4] <span class="op">times</span> 123
2430+
</pre><p>
2431+
or
2432+
</p><pre class="indent">
2433+
[0 <span class="op">len</span> 5] <span class="op">times</span> 123
2434+
</pre><p>
2435+
The minimum index and the size of <tt><span class="type">array</span></tt> types like <tt><span class="type">array</span> <span class="type">integer</span></tt> may be
2436+
changed at run-time. Functions like <span class="func">minIdx</span>, <span class="func">maxIdx</span> and <span class="func">length</span> can be used to
2437+
determine the current properties of an array value.
2438+
</p><p>
2439+
In base idx <tt><span class="type">arrays</span></tt> the minimum index is part of the type. E.g.:
2440+
</p><pre class="indent">
2441+
<span class="keywd">const</span> <span class="type">type</span>: nameList <span class="keywd">is</span> <span class="type">array</span> [1 ..] <span class="type">string</span>; <span class="comment"># minimum index is 1</span>
2442+
<span class="keywd">const</span> <span class="type">type</span>: huffmanSymbolArray <span class="keywd">is</span> <span class="type">array</span> [0 ..] <span class="type">integer</span>; <span class="comment"># minimum index is 0</span>
2443+
</pre><p>
2444+
The size of a base idx <tt><span class="type">array</span></tt> may be changed at run-time.
2445+
</p><p>
2446+
In fixed size <tt><span class="type">arrays</span></tt> the minimum index and the size are part
2447+
of the type. E.g.:
2448+
</p><pre class="indent">
2449+
<span class="keywd">const</span> <span class="type">type</span>: dataBlockType <span class="keywd">is</span> <span class="type">array</span> [64] <span class="type">integer</span>; <span class="comment"># minimum index is 1 and maximum index is 64</span>
2450+
<span class="keywd">const</span> <span class="type">type</span>: keccakStateType <span class="keywd">is</span> <span class="type">array</span> [0 .. 24] <span class="type">bin64</span>; <span class="comment"># minimum index is 0 and maximum index is 24</span>
2451+
</pre><p>
2452+
Finally, there are indexed <tt><span class="type">arrays</span></tt> where the index may be any type that
2453+
can be converted to an integer. E.d:
2454+
</p><pre class="indent">
2455+
<span class="keywd">const</span> <span class="type">type</span>: charIndexArray <span class="keywd">is</span> <span class="type">array</span> [char] <span class="type">bigInteger</span>;
2456+
</pre><p>
2457+
A <tt><span class="type">hash</span></tt> can be used if the index type does not map to an <tt><span class="type">integer</span></tt>.
2458+
</p></div>
2459+
24082460
<div><br /><a name="faq_comparisons"><h3>How are comparisons done in Seed7?
24092461
</h3></a><hr />
24102462
<p>
@@ -3773,7 +3825,7 @@ <h2>
37733825
match fails, because a corresponding declaration is not found, you will get
37743826
an error like:
37753827
</p><pre class="indent">
3776-
*** chkloop.sd7(35):52: <span class="link">Match for {while "X" do {1 + 2 } end while } failed</span>
3828+
*** chkloop.sd7(35):57: <span class="link">Match for {while "X" do {1 + 2 } end while } failed</span>
37773829
</pre><p>
37783830
If all expressions are found in the dictionary the matching process leads to an
37793831
enriched AST, the <a class="link" href="#faq_bytecode">call-code</a>. Call-code can be executed by the <a class="link" href="#faq_interpreter">interpreter</a>.

doc/faq.txt

+63-14
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,12 @@ How many lines of code are in the Seed7 project?
346346
================================================
347347

348348
The Seed7 package contains more than 100000 lines of C and more
349-
than 400000 lines of Seed7. For version 2025-01-11 the number of lines is:
349+
than 400000 lines of Seed7. For version 2025-03-25 the number of lines is:
350350

351-
184871 C source files (*.c)
352-
13806 C header files (*.h)
353-
267373 Seed7 source files (*.sd7)
354-
197752 Seed7 library/include files (*.s7i)
351+
188316 C source files (*.c)
352+
14009 C header files (*.h)
353+
272719 Seed7 source files (*.sd7)
354+
198222 Seed7 library/include files (*.s7i)
355355

356356
C code (*.c and *.h files) can be divided into the following areas:
357357

@@ -1263,7 +1263,10 @@ as afterthought. This works worse than in a statically typed language. Since
12631263
type annotations are optional they are not considered when the program is
12641264
written, but at a later time (maybe by someone else). If the type annotations
12651265
are not 100% correct unnecessary conversions might take place, which slow
1266-
down the program.
1266+
down the program. Python has type annotations and this would allow writing
1267+
performance critical code in Python instead of C/C++. But in practice the
1268+
type annotations of Python did not lead to a situation where C/C++ code is
1269+
not needed.
12671270

12681271

12691272
How can static type checking work if types are first-class objects?
@@ -1335,7 +1338,7 @@ Why does a local type declaration trigger an error?
13351338

13361339
triggers the error:
13371340

1338-
*** tst249.sd7(6):52: Match for {var intArrayType : {arr } is {[ ] {1 , 2 } } } failed
1341+
*** tst249.sd7(6):57: Match for {var intArrayType : {arr } is {[ ] {1 , 2 } } } failed
13391342
var intArrayType: arr is [](1, 2);
13401343

13411344
A 'local' declaration block is parsed completely before it is executed.
@@ -1365,7 +1368,7 @@ Why does a two-dimensional array trigger an error?
13651368

13661369
triggers the error:
13671370

1368-
*** tst309.sd7(4):52: Match for {func result var func type: <BLOCKOBJECT> ({array type: <TYPEOBJECT> ({array string }) }) : {data } is {0 times {0 times "" } } begin {data := {3 times {2 times value } } } end func } failed
1371+
*** tst309.sd7(4):57: Match for {func result var func type: <BLOCKOBJECT> ({array type: <TYPEOBJECT> ({array string }) }) : {data } is {0 times {0 times "" } } begin {data := {3 times {2 times value } } } end func } failed
13691372
const func array array string: test (in string: value) is func
13701373

13711374
The reason is: The two occurrences of 'array array string' are considered
@@ -1528,10 +1531,10 @@ what happens if the function f is overloaded with different result types:
15281531

15291532
This overloading of the result type triggers compile-time errors:
15301533

1531-
*** tst508.sd7(4):34: Redeclaration of "f (val char: x)"
1534+
*** tst508.sd7(4):43: Redeclaration of "f (val char: x)"
15321535
const func string: f (in char: x) is return str(x);
15331536
----------------------------------------------------^
1534-
*** tst508.sd7(3):35: Previous declaration of "f (val char: x)"
1537+
*** tst508.sd7(3):44: Previous declaration of "f (val char: x)"
15351538
const func integer: f (in char: x) is return ord(x);
15361539

15371540
Assume return type overloading would be allowed. In this case the expression
@@ -1614,7 +1617,7 @@ The syntax of this variable declaration is defined in the file syntax.s7i.
16141617
A variable declaration with := would need a different syntax definition.
16151618
An attempt to define this new syntax leads to an error:
16161619

1617-
*** tst356.sd7(3):42: ":=" redeclared with infix priority 127 not 20
1620+
*** tst356.sd7(3):52: ":=" redeclared with infix priority 127 not 20
16181621
syntax expr: .var.(). : .(expr). := .(expr) is -> 40;
16191622
---------------------------------------------------------^
16201623

@@ -1648,14 +1651,14 @@ would be interpreted as
16481651
Since the syntax pattern would expect a := after 'number := 42;' this
16491652
would lead to the error:
16501653

1651-
*** tst356.sd7(8):47: ":=" expected found "begin"
1654+
*** tst356.sd7(8):40: ":=" expected found "begin"
16521655
begin
16531656
-------^
16541657

16551658
To avoid this misinterpretation, the syntax of a variable declaration
16561659
with := is rejected beforehand with:
16571660

1658-
*** tst356.sd7(3):42: ":=" redeclared with infix priority 127 not 20
1661+
*** tst356.sd7(3):52: ":=" redeclared with infix priority 127 not 20
16591662

16601663
Languages with hard-coded syntax analysis use a trick to allow the same
16611664
symbol for assignments and initialization. They read the parameter
@@ -1863,6 +1866,52 @@ for the purpose it has been invented, thousands of years ago, long before
18631866
zero has been introduced.
18641867

18651868

1869+
Are arrays indexed from one?
1870+
============================
1871+
1872+
You can set the minimum index of an array. Standard 'array' types like
1873+
'array integer' do not define a minimum index or the size of the array.
1874+
Instead of being defined by the type the minimum index and the size are
1875+
part of the array value. For an 'array integer' the minimum index could be
1876+
0, 1, 1000 or even -3. An 'array integer' consisting of 5 elements, each
1877+
with the value 123, is created with:
1878+
1879+
5 times 123
1880+
1881+
In this case the minimum index is 1. The same array with a minimum index
1882+
of 0 is created with:
1883+
1884+
[0 .. 4] times 123
1885+
1886+
or
1887+
1888+
[0 len 5] times 123
1889+
1890+
The minimum index and the size of 'array' types like 'array integer' may be
1891+
changed at run-time. Functions like minIdx, maxIdx and length can be used to
1892+
determine the current properties of an array value.
1893+
1894+
In base idx 'arrays' the minimum index is part of the type. E.g.:
1895+
1896+
const type: nameList is array [1 ..] string; # minimum index is 1
1897+
const type: huffmanSymbolArray is array [0 ..] integer; # minimum index is 0
1898+
1899+
The size of a base idx 'array' may be changed at run-time.
1900+
1901+
In fixed size 'arrays' the minimum index and the size are part
1902+
of the type. E.g.:
1903+
1904+
const type: dataBlockType is array [64] integer; # minimum index is 1 and maximum index is 64
1905+
const type: keccakStateType is array [0 .. 24] bin64; # minimum index is 0 and maximum index is 24
1906+
1907+
Finally, there are indexed 'arrays' where the index may be any type that
1908+
can be converted to an integer. E.d:
1909+
1910+
const type: charIndexArray is array [char] bigInteger;
1911+
1912+
A 'hash' can be used if the index type does not map to an 'integer'.
1913+
1914+
18661915
How are comparisons done in Seed7?
18671916
==================================
18681917

@@ -3231,7 +3280,7 @@ of a tree. The expressions from the AST are matched with the dictionary. If a
32313280
match fails, because a corresponding declaration is not found, you will get
32323281
an error like:
32333282

3234-
*** chkloop.sd7(35):52: Match for {while "X" do {1 + 2 } end while } failed
3283+
*** chkloop.sd7(35):57: Match for {while "X" do {1 + 2 } end while } failed
32353284

32363285
If all expressions are found in the dictionary the matching process leads to an
32373286
enriched AST, the call-code. Call-code can be executed by the interpreter.

0 commit comments

Comments
 (0)