18 private Lexer.TokenType token;
20 public Parser(StreamReader stream) {
21 lexer = new Lexer(stream);
25 token = lexer.GetNextToken();
30 if(token == Lexer.TokenType.EOF) {
36 Console.WriteLine("Token: " + token.ToString() + " - " +
40 case Lexer.TokenType.CLOSE_PAREN:
42 throw new Exception("Parse Error: unexpected )");
44 type = LispType.END_LIST;
46 case Lexer.TokenType.OPEN_PAREN:
47 type = LispType.START_LIST;
50 case Lexer.TokenType.SYMBOL:
51 type = LispType.SYMBOL;
53 case Lexer.TokenType.STRING:
54 type = LispType.STRING;
56 case Lexer.TokenType.TRUE:
57 type = LispType.BOOLEAN;
59 case Lexer.TokenType.INTEGER:
60 type = LispType.INTEGER;
66 private LispType type;
67 public LispType Type {
70 private bool delayinc;
76 public string SymbolValue {
77 get { return lexer.TokenString; }
79 public string StringValue {
80 get { return lexer.TokenString; }
82 public int IntegerValue {
83 get { return Int32.Parse(lexer.TokenString); }
85 public bool BoolValue {
86 get { return StringValue == "t" ? true : false; }
88 public float FloatValue {
89 get { return Single.Parse(lexer.TokenString); }