All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scm.driver Maven / Gradle / Ivy

package scm;

import java.io.*;
import java.util.*;
import jas.RuntimeConstants;

class driver implements RuntimeConstants
{
  static Hashtable syms;
  public static void main(String argv[])
    throws Exception
  {
    String infileName, outfileName;
    StreamTokenizer inp;

    if (argv.length == 0)
        inp = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
      //inp = new StreamTokenizer(System.in);
    else
      inp =
        new StreamTokenizer(new BufferedReader(new InputStreamReader
        (new BufferedInputStream
         (new FileInputStream(argv[0])))));
      //inp =
      //  new StreamTokenizer
      //  (new BufferedInputStream
      //   (new FileInputStream(argv[0])));

    inp.resetSyntax();
    inp.wordChars('a', 'z');
    inp.wordChars('A', 'Z');
    inp.wordChars('!', '!');
    inp.wordChars('?', '?');
    inp.wordChars('_', '_');
    inp.wordChars(128 + 32, 255);
    inp.whitespaceChars(0, ' ');
    inp.quoteChar('"');
    inp.commentChar(';');
    inp.parseNumbers();
    inp.eolIsSignificant(false);

    Env global = new Env();

    global.definevar(Symbol.intern("define"), new Define());
    global.definevar(Symbol.intern("set!"), new Setvar());
    global.definevar(Symbol.intern("lambda"), new Lambda());
    global.definevar(Symbol.intern("quote"), new Quote());
    global.definevar(Symbol.intern("car"), new Car());
    global.definevar(Symbol.intern("cdr"), new Cdr());
    global.definevar(Symbol.intern("cons"), new Cons());
    global.definevar(Symbol.intern("cond"), new Cond());
    global.definevar(Symbol.intern("num?"), new NumP());
    global.definevar(Symbol.intern("string?"), new StringP());
    global.definevar(Symbol.intern("progn"), new Progn());
    global.definevar(Symbol.intern("mapcar"), new Mapcar());
    global.definevar(Symbol.intern("+"), new Plus());
    global.definevar(Symbol.intern("-"), new Minus());
    global.definevar(Symbol.intern("*"), new Mult());
    global.definevar(Symbol.intern("/"), new Div());
    global.definevar(Symbol.intern("|"), new Or());
    global.definevar(Symbol.intern("<"), new LessP());
    global.definevar(Symbol.intern(">"), new MoreP());
    global.definevar(Symbol.intern("eq?"), new EqP());


                                // Include jas stuff now.

                                // load in constants

    global.definevar(Symbol.intern("acc-public"),
                     new Selfrep(ACC_PUBLIC));
    global.definevar(Symbol.intern("acc-private"),
                     new Selfrep(ACC_PRIVATE));
    global.definevar(Symbol.intern("acc-protected"),
                     new Selfrep(ACC_PROTECTED));
    global.definevar(Symbol.intern("acc-static"),
                     new Selfrep(ACC_STATIC));
    global.definevar(Symbol.intern("acc-final"),
                     new Selfrep(ACC_FINAL));
    global.definevar(Symbol.intern("acc-synchronized"),
                     new Selfrep(ACC_SYNCHRONIZED));
    global.definevar(Symbol.intern("acc-volatile"),
                     new Selfrep(ACC_VOLATILE));
    global.definevar(Symbol.intern("acc-transient"),
                     new Selfrep(ACC_TRANSIENT));
    global.definevar(Symbol.intern("acc-native"),
                     new Selfrep(ACC_NATIVE));
    global.definevar(Symbol.intern("acc-interface"),
                     new Selfrep(ACC_INTERFACE));
    global.definevar(Symbol.intern("acc-abstract"),
                     new Selfrep(ACC_ABSTRACT));
    global.definevar(Symbol.intern("acc-strictfp"),
                     new Selfrep(ACC_STRICTFP));

                                // Pull in auto generated stuff
    AutoInit.fillit(global);

                                // now add in procedures for opcodes
    int opc_cnt = opcNames.length;
    for (int i=0; i':
        ret =  Symbol.intern(String.valueOf((char)(inp.ttype)));
        break;
      default:
        throw new SchemeError("Unexpected parse error");
      }
    return ret;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy