carl
This commit is contained in:
10
tests/carl/Errors/entry.undeclaredType.alpha
Normal file
10
tests/carl/Errors/entry.undeclaredType.alpha
Normal file
@ -0,0 +1,10 @@
|
||||
type M : string -> integer
|
||||
|
||||
function foo : M
|
||||
|
||||
foo (s) := {
|
||||
[
|
||||
int: x
|
||||
]
|
||||
return 0;
|
||||
}
|
16
tests/carl/Errors/entry.undeclaredType.alpha.asc
Normal file
16
tests/carl/Errors/entry.undeclaredType.alpha.asc
Normal 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:
|
7
tests/carl/Errors/entry.undeclaredVar.alpha
Normal file
7
tests/carl/Errors/entry.undeclaredVar.alpha
Normal file
@ -0,0 +1,7 @@
|
||||
type M : string -> integer
|
||||
|
||||
function entry : M
|
||||
|
||||
entry(s) := {
|
||||
return x;
|
||||
}
|
12
tests/carl/Errors/entry.undeclaredVar.alpha.asc
Normal file
12
tests/carl/Errors/entry.undeclaredVar.alpha.asc
Normal 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:
|
14
tests/carl/Errors/error.operator.alpha
Normal file
14
tests/carl/Errors/error.operator.alpha
Normal 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;
|
||||
}
|
19
tests/carl/Errors/error.operator.alpha.asc
Normal file
19
tests/carl/Errors/error.operator.alpha.asc
Normal 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:
|
Reference in New Issue
Block a user