Files
compiler-the-translators/tests/sprint3/expected/sp3_carls_second_mistake.asc.exp
2025-05-04 16:05:13 -04:00

36 lines
1.6 KiB
Plaintext

001: type main: string -> integer
002: function entry: main
003:
004: type string: 1 -> character
005: type a_of_s: 1 -> string
006:
007: (* maybe some other type definitions *)
008:
009: entry (arg) := {
010: [ string: one_name; string: another_name; a_of_s: many_names ]
011:
012: one_name := "a string literal";
013: another_name := reserve another_name(4); (* reserve space for an an array of character, with 4 members *)
LINE (13:44) ** TYPE ERROR: Assignable Assign Expression - Object another_name of type string != Object undefined of type undefined
014: another_name(0) := 'C';
015: another_name(1) := 'a';
016: another_name(2) := 'r';
017: another_name(3) := 'l';
018: many_names := reserve many_names(3);
LINE (18:40) ** TYPE ERROR: Assignable Assign Expression - Object many_names of type a_of_s != Object undefined of type undefined
019: many_names(0) := one_name;
020: many_names(1) := another_name;
021: many_names(2) := reserve many_names(2)(6); (* reserve space for an item of the same type as a_of_s(2), an array of character, with 6 members *)
LINE (21:45) ** SYNTAX ERROR: Incorrect syntax at token ')'
LINE (21:44) ** SYNTAX ERROR: Incorrect syntax at token '6'
LINE (21:43) ** SYNTAX ERROR: Incorrect syntax at token '('
LINE (21:43) ** TYPE ERROR: Assignable Assign Expression - Object $t20 of type string != Object undefined of type undefined
022: many_names(2)(0) := 'P';
023: many_names(2)(1) := 'a';
024: many_names(2)(2) := 'r';
025: many_names(2)(3) := 't';
026: many_names(2)(4) := 'h';
027: many_names(2)(5) := 'o';
028:
029: return 0;
030: }