public static Sequence Analyze(Parsing.SList expr) { var bodyExpressions = (from sExpr in expr.Skip(1) select Parsing.Analyzer.Analyze(sExpr)).ToList(); return(new Sequence(bodyExpressions)); }
public static Application Analyze(Parsing.SList expr) { var car = expr[0]; var cdr = expr.Skip(1); var procExpression = Parsing.Analyzer.Analyze(car); var args = from arg in cdr select Parsing.Analyzer.Analyze(arg); return(new Application(procExpression, args)); }
public static Quotation Analyze(Parsing.SList expr) { if (expr.Count != 2) { throw new BadSyntaxException(KeyWord, string.Empty, expr.Text); } string text = expr[1].Text; return(new Quotation(text)); }
public void PopAndCheck() { if (stack.Count == 1) { throw new ScannerErrorException("No matching opening bracket"); } SList topList = stack.Pop(); //if (topList.Count == 0) // throw new ScannerException("Empty application"); stack.Peek().Add(topList); }
public static IfConstruct Analyze(Parsing.SList expr) { if (expr.Count != 3 && expr.Count != 4) { throw new BadSyntaxException(KeyWord, string.Empty, expr.Text); } Expression predicate = Parsing.Analyzer.Analyze(expr[1]); Expression consequent = Parsing.Analyzer.Analyze(expr[2]); Expression alternative = null; if (expr.Count == 4) { alternative = Parsing.Analyzer.Analyze(expr[3]); } return(new IfConstruct(predicate, consequent, alternative)); }