| 1 | use strict; use warnings; | ||
| 2 | package Lingy::Compiler; | ||
| 3 | |||
| 4 | use Lingy::Common; | ||
| 5 | use Lingy::Symbol; | ||
| 6 | use Lingy::HashMap; | ||
| 7 | |||
| 8 | use constant DEF => symbol('def'); | ||
| 9 | use constant LOOP => symbol('loop*'); | ||
| 10 | use constant RECUR => symbol('recur'); | ||
| 11 | use constant IF => symbol('if'); | ||
| 12 | use constant CASE => symbol('case*'); | ||
| 13 | use constant LET => symbol('let*'); | ||
| 14 | use constant LETFN => symbol('letfn*'); | ||
| 15 | use constant DO => symbol('do'); | ||
| 16 | use constant FN => symbol('fn*'); | ||
| 17 | use constant QUOTE => symbol('quote'); | ||
| 18 | use constant THE_VAR => symbol('var'); | ||
| 19 | use constant IMPORT => symbol('import*'); | ||
| 20 | use constant DOT => symbol('.'); | ||
| 21 | use constant ASSIGN => symbol('set!'); | ||
| 22 | use constant DEFTYPE => symbol('deftype*'); | ||
| 23 | use constant REIFY => symbol('reify*'); | ||
| 24 | ### TRY_FINALLY | ||
| 25 | use constant TRY => symbol('try'); | ||
| 26 | use constant THROW => symbol('throw'); | ||
| 27 | use constant MONITOR_ENTER => symbol('monitor-enter'); | ||
| 28 | use constant MONITOR_EXIT => symbol('monitor-exit'); | ||
| 29 | ### INSTANCE | ||
| 30 | ### IDENTICAL | ||
| 31 | ### THISFN | ||
| 32 | use constant CATCH => symbol('catch'); | ||
| 33 | use constant FINALLY => symbol('finally'); | ||
| 34 | ### CLASS | ||
| 35 | use constant NEW => symbol('new'); | ||
| 36 | ### UNQUOTE | ||
| 37 | ### UNQUOTE_SPLICING | ||
| 38 | ### SYNTAX_QUOTE | ||
| 39 | use constant _AMP_ => symbol('&'); | ||
| 40 | |||
| 41 | |||
| 42 | use constant specials => HASHMAP->new([ | ||
| 43 | DEF, nil, | ||
| 44 | LOOP, nil, # change to loop* | ||
| 45 | RECUR, nil, | ||
| 46 | IF, nil, | ||
| 47 | LET, nil, | ||
| 48 | # LETFN, nil, | ||
| 49 | DO, nil, | ||
| 50 | FN, nil, | ||
| 51 | QUOTE, nil, | ||
| 52 | THE_VAR, nil, | ||
| 53 | IMPORT, nil, | ||
| 54 | DOT, nil, | ||
| 55 | # ASSIGN, nil, | ||
| 56 | # DEFTYPE, nil, | ||
| 57 | # REIFY, nil, | ||
| 58 | TRY, nil, | ||
| 59 | THROW, nil, | ||
| 60 | # MONITOR_ENTER, nil, | ||
| 61 | # MONITOR_EXIT, nil, | ||
| 62 | CATCH, nil, | ||
| 63 | # FINALLY, nil, | ||
| 64 | NEW, nil, | ||
| 65 | # _AMP_, nil, | ||
| 66 | |||
| 67 | # TODO Maybe add these: | ||
| 68 | ### UNQUOTE | ||
| 69 | ### UNQUOTE_SPLICING | ||
| 70 | ### SYNTAX_QUOTE | ||
| 71 | ]); | ||
| 72 | |||
| 73 | 1; |