|
|
1.1 ! root 1: open Calc.LexValue ! 2: type lexresult=V ! 3: val eof = fn () => EOF ! 4: %% ! 5: alpha=[A-Za-z]; ! 6: digit=[0-9]; ! 7: ws = [\ \t\n]; ! 8: %% ! 9: {ws}+ => (lex()); ! 10: {digit}+ => (NUM (revfold (fn (a,r) => ord(a)-ord("0")+10*r) (explode yytext) 0)); ! 11: "+" => (PLUS); ! 12: "*" => (TIMES); ! 13: ";" => (EOS); ! 14: {alpha}+ => (if yytext="print" then PRINT else ID yytext); ! 15: "-" => (SUB); ! 16: "^" => (CARAT); ! 17: "/" => (DIV); ! 18: . => (Calc.HDR.error ("ignoring bad character " ^ yytext); lex());
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.