This server is intended for use for Academic Classwork related Git repositories only. Projects/repositories will generally be removed after 6 months following close of the semester. Inactive repositories from previous semester are now being archived when no activity for 365 days. They are renamed and marked as 'archived'. After 90 days in that state they will be removed from the system completely.

evanshogan.l 2.01 KB
Newer Older
Jonathan Evans's avatar
Jonathan Evans committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*
 *
 *
 *
 *
 */

%{
    int numLines = 1;
    void beginScope();
%}

NEWLINE \n
WSPACE	[ \t\v\r]+
UNDERSCORE _
DIGIT [0-9]
ALPHA [A-Za-z]

ALPHANUM {DIGIT}|{ALPHA}

IDENT ({ALPHA}|{UNDERSCORE})({ALPHANUM}|{UNDERSCORE})*
INTCONST (\+|-)?{DIGIT}*
Jonathan Evans's avatar
Jonathan Evans committed
23
STRCONST \"[^\"\n]*\"
Jonathan Evans's avatar
Jonathan Evans committed
24

Jonathan Evans's avatar
Jonathan Evans committed
25
COMMENT ";".*
Jonathan Evans's avatar
Jonathan Evans committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162

%%

{COMMENT}   {}

"let*"      {
            beginScope();
            return T_LETSTAR;
            }

"lambda"    {
            beginScope();
            return T_LAMBDA;
            }

"input"     {
            return T_INPUT;
            }

"print"     {
            return T_PRINT;
            }

"if"        {
            return T_IF;
            }

"exit"      {
            return T_EXIT;
            }

"progn"     {
            return T_PROGN;
            }

"("         {
            return T_LPAREN;
            }

")"         {
            return T_RPAREN;
            }


"+"         {
            return T_ADD;
            }

            
"*"         {
            return T_MULT;
            }


"/"         {
            return T_DIV;
            }


"-"         {
            return T_SUB;
            }

"and"       {
            return T_AND;
            }


"or"        {
            return T_OR;
            }


"not"       {
            return T_NOT;
            }


"<"         {
            return T_LT;
            }


">"         {
            return T_GT;
            }

"<="        {
            return T_LE;
            }


">="        {
            return T_GE;
            }


"="         {
            return T_EQ;
            }


"/="        {
            return T_NE;
            }

"t"         {
            return T_T;
            }

"nil"       {
            return T_NIL;
            }

{IDENT}     {
            yylval.text = strdup(yytext);
            return T_IDENT;
            }

{INTCONST}  {
            return T_INTCONST;
            }

{STRCONST}  {
            return T_STRCONST;
            }

{NEWLINE}   { 
            numLines++;
            }

{WSPACE}    { }

.           {
            return T_UNKNOWN;
            }
%%