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,31 @@
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: