Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -0,0 +1,34 @@
|
|||
-- Here is the fleshed-out code using the snippets from above
|
||||
-- Note that I could have enhanced the output by not displaying the last comma
|
||||
-- December 2024, R. B. E.
|
||||
|
||||
with Ada.Text_IO;
|
||||
|
||||
procedure Generate_Lower_Case_ASCII_Alphabet is
|
||||
|
||||
-- We start with a strong type definition: A character range that can only hold lower-case letters:
|
||||
|
||||
type Lower_Case is new Character range 'a' .. 'z';
|
||||
|
||||
-- Now we define an array type and initialize the Array A of that type with the 26 letters:
|
||||
|
||||
type Arr_Type is array (Integer range <>) of Lower_Case;
|
||||
A : Arr_Type (1 .. 26) := "abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
-- Strong typing would catch two errors: (1) any upper-case letters or
|
||||
-- other symbols in the string assigned to A, and (2) too many or too
|
||||
-- few letters assigned to A. However, a letter might still appear
|
||||
-- twice (or more) in A, at the cost of one or more other
|
||||
-- letters. Array B is safe even against such errors:
|
||||
|
||||
B : Arr_Type (1 .. 26);
|
||||
begin
|
||||
B(B'First) := 'a';
|
||||
for I in B'First .. B'Last-1 loop
|
||||
B(I+1) := Lower_Case'Succ(B(I));
|
||||
end loop; -- now all the B(I) are different
|
||||
for I in B'First .. B'Last loop
|
||||
Ada.Text_IO.Put (B(I)'Image & ", ");
|
||||
end loop;
|
||||
Ada.Text_IO.New_Line;
|
||||
end Generate_Lower_Case_ASCII_Alphabet;
|
||||
|
|
@ -1,9 +1,19 @@
|
|||
\\ old style Basic, including a Binary.Or() function
|
||||
Module OldStyle {
|
||||
10 LET A$=""
|
||||
20 FOR I=ASC("A") TO ASC("Z")
|
||||
30 LET A$=A$+CHR$(BINARY.OR(I, 32))
|
||||
40 NEXT I
|
||||
50 PRINT A$
|
||||
20 DEF FNUP$(I)=""""+CHR$(BINARY.OR(I, 32))+""""
|
||||
30 FOR I=ASC("A") TO ASC("Y")
|
||||
40 LET A$= A$ + FNUP$(I, 32)+", "
|
||||
50 NEXT I
|
||||
60 LET A$ = A$+ FNUP$(I, 32)
|
||||
70 PRINT A$
|
||||
}
|
||||
CALL OldStyle
|
||||
|
||||
Module new_style {
|
||||
a=("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
|
||||
map1= lambda ->{push binary.or(asc(letter$), 32)}
|
||||
map2= lambda ->{push chr$(number)}
|
||||
Print """"+a#map(map1, map2)#str$({", "})+""""
|
||||
}
|
||||
new_style
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
format ELF64 executable 3
|
||||
entry begin
|
||||
|
||||
segment executable readable
|
||||
begin:
|
||||
mov rcx, 26
|
||||
mov rdi, alphabet
|
||||
mov rax, 'a'
|
||||
.loop0:
|
||||
stosb
|
||||
inc rax
|
||||
loop .loop0
|
||||
mov byte[alphabet + 26], 0x0a
|
||||
.print0:
|
||||
mov rax, 1
|
||||
mov rdi, 1
|
||||
mov rsi, alphabet
|
||||
mov rdx, 27
|
||||
syscall
|
||||
.end:
|
||||
mov rax, 60
|
||||
xor rdi, rdi
|
||||
syscall
|
||||
|
||||
segment readable writeable
|
||||
alphabet: rb 27
|
||||
Loading…
Add table
Add a link
Reference in a new issue