This commit is contained in:
Scarlett
2025-04-15 14:46:00 -04:00
parent 8057060f26
commit c091927fe7
34 changed files with 730 additions and 0 deletions

View File

@ -0,0 +1,10 @@
type M : string -> integer
function foo : M
foo (s) := {
[
int: x
]
return 0;
}

View File

@ -0,0 +1,16 @@
alpha parser, version 0.2 (2023-03-04) - Annotated Source Code for file entry.undeclaredType.alpha
001: type M : string -> integer
002:
003: function foo : M
004:
005: foo (s) := {
006: [
007: int: x
^0 ^1
LINE 7:9 ** ERROR #0: the name 'int', used here as a type, has not been declared at this point in the program.
LINE 7:14 ** ERROR #1: the name 'x' is being declared with an unknown type.
008: ]
009: return 0;
010: }
011:

View File

@ -0,0 +1,7 @@
type M : string -> integer
function entry : M
entry(s) := {
return x;
}

View File

@ -0,0 +1,12 @@
alpha parser, version 0.2 (2023-03-04) - Annotated Source Code for file entry.undeclaredVar.alpha
001: type M : string -> integer
002:
003: function entry : M
004:
005: entry(s) := {
006: return x;
^0
LINE 6:12 ** ERROR #0: the name 'x', used here as a variable name, has not been declared at this point in the program.
007: }
008:

View File

@ -0,0 +1,14 @@
type string2int: string -> integer
function entry : string2int
entry(arg) := {
[ integer: i; integer: sum ]
sum := 0;
i := 0;
while (i < 10) {
sum = sum + i;
i := i + 1;
}
return 0;
}

View File

@ -0,0 +1,19 @@
alpha parser, version 0.2 (2023-03-04) - Annotated Source Code for file error.operator.alpha
001: type string2int: string -> integer
002:
003: function entry : string2int
004:
005: entry(arg) := {
006: [ integer: i; integer: sum ]
007: sum := 0;
008: i := 0;
009: while (i < 10) {
010: sum = sum + i;
^0
LINE 10:13 ** ERROR #0: assignment operator (:=) expected but equality operator (=) found.
011: i := i + 1;
012: }
013: return 0;
014: }
015: