public override ISexpr VisitAtom(SexprParser.AtomContext context) { var text = context.GetText(); if (context.SYMBOL() != null) { return(Sexpr.Symbol(text)); } else if (context.STRING() != null) { return(Sexpr.String(text)); } else if (context.NUMBER() != null) { return(Sexpr.Number(text)); } else { throw new Exception(); } }
public override ISexpr VisitQuote(SexprParser.QuoteContext context) { return(Sexpr.List(new[] { Sexpr.Symbol("quote"), VisitItem(context.item()) })); }