Files
compiler-the-translators/tests/given/expected/sample.good.alpha.asc
2025-05-04 16:05:13 -04:00

32 lines
833 B
Plaintext

alpha parser, version 0.2 (2023-03-04) - Annotated Source Code for file sample.good.alpha
001:
001: (* Type definitions *)
003: type int2int: integer -> integer
004: type string2int: string -> integer
005:
006: (* Function declarations
007: They use the above type definitions
008: *)
009: function square : int2int
010: function entry : string2int
011:
012: (* Function definition
013: Functions must be declared before they are defined
014: *)
015: square(x) := {
016: return x * x;
017: }
018:
019: (* Function definition
020: entry is the first function called
021: *)
022: entry(arg) := {
023: [ integer: input ; integer: expected ; integer: actual ; Boolean: result ]
024: input := 7;
025: expected := 49;
026: actual := square(input);
027: result := expected = actual;
028: return 0;
029: }
030: