<div class="document" id="basic"
     title="A Quick, Dirty and Ugly BASIC implemented in Common Lisp"
     description="BASIC in Common Lisp"
     author="Pascal J. Bourguignon"
     keywords="BASIC, Common Lisp, Lisp"

  <H2>A Quick, Dirty and Ugly Basic interpreter</H2>

  <p>This is a silly BASIC interpreter, implemented in Common Lisp.</p>

  <p>The lines are tokenized and stored as-is in an array indexed by
    the line number.  When interpreting the program, the instructions
    are parsed directly from there ; the expressions are parsed into
    trees which are then evaluated.</p>

  <p>The variables are stored into a hash table indexed by their
    identifier (symbol). Undefined variables are taken as 0 or "".</p>

  <p>We distinguish number and string variables depending on the presence
    of a '$' character in the last position of the variable identifier.</p>

  <p>Variables are reset by the command RUN. (A program can be
    restarted without losing the variable using the GOTO or GOSUB
    statements).  Commands are not distinguished from statements and
    may occur in a program. In particular, LOAD could be used to
    load a subprogram overlay, and takes a line number where to jump
    to. </p>

  <p>Programs are loaded and saved in source form.</p>

    <LI><A HREF="basic.lisp">basic.lisp</A></LI>
    <LI><A HREF="test1.basic">test1.basic</A></LI>
    <LI><A HREF="test2.basic">test2.basic</A></LI>