aquan changes
Getty Ritter
9 years ago
16 | 16 | {- The ::= operator is for the common case that we want to select from a |
17 | 17 | - whole bunch of literal characters or words. It is referred to as the |
18 | 18 | - 'literal assignment operator'. -} |
19 | vowel ::= a e i o u | |
20 | consonant ::= p t k w h m n l | |
19 | vowel = $(a e i o u) | |
20 | consonant = $(p t k w h m n l) | |
21 | 21 | |
22 | 22 | {- The := operator sets the value on the left to be |
23 | syll = vowel | consonant vowel | |
24 | | vowel "'" | consonant vowel "'" | |
25 | word = syll syll (6 @ syll) | |
23 | syll = vowel | consonant vowel | vowel "'" | consonant vowel "'" | |
24 | word = syll syll (rep.6.syll) | |
26 | 25 | |
27 | 26 | |
28 | 27 | {- Fixing a value -} |
45 | 44 | |
46 | 45 | pronoun.Male = "he" |
47 | 46 | pronoun.Female = "she" |
47 | pronoun.NB = "they" | |
48 | ||
48 | 49 | person.Male = "man" |
49 | 50 | person.Female = "woman" |
51 | person.NB = "person" | |
50 | 52 | |
51 | fixed gender = Male | Female | |
52 | hair ::= long short | |
53 | hair_color ::= brown black blonde red white | |
54 | eye_color ::= blue black brown green | |
55 | mood ::= happy sad angry | |
53 | fixed gender = Male | Female | NB | |
54 | hair = $(long short) | |
55 | hair_color = $(brown black blonde red white) | |
56 | eye_color = $(blue black brown green) | |
57 | mood = $(happy sad angry) | |
56 | 58 | |
57 | 59 | puts "This {person.gender} has {hair}, {hair_color} hair and " |
58 | 60 | "{eye_color} eyes; {pronoun.gender} appears to be " |