[Coco] Re: BASIC irony

Nathan Woods npwoods at cybercom.net
Fri Aug 13 11:48:18 EDT 2004


If all you are doing is tokenizing BASIC, you could probably get the job
done with a pretty simple lex file along these lines:

LINEBEGIN
{
; Line numbers
\d* { short i = atoi(yytext); fwrite(&i, 1, 2, stdout);
BEGIN(LINEBEGIN); }
}


INLINE
{

\r|\n { putc(\r); BEGIN(LINEBEGIN); }

; Basic tokens; these two examples are probably not correct so bear with
me...
FOR { putc('\x80'); }
INPUT { putc('\x81'); }

...

. { puts(yytext); }

}




More information about the Coco mailing list