Exemplo n.º 1
0
        public Value CompileBlockStmt(BlockStmt stmt)
        {
            switch (stmt)
            {
            case BlockLet s: return(CompileBlockStmt(s));

            case BlockExpr e: return(CompileExpr(e.Expr));

            default:
                throw new Exception("unknown AST node " + stmt.GetType());
            }
        }
Exemplo n.º 2
0
        public void Visit(BlockStmt t, IEnvironment env)
        {
            if (debug)
            {
                System.Console.WriteLine("BlockStmt: " + t.GetType().ToString());
            }
            object res = 0;

            foreach (ASTree tree in t)
            {
                if (!(tree is NullStmt))
                {
                    tree.Accept(this, env);
                    if (result is ErrorValue)
                    {
                        return;
                    }
                    res = result;
                }
            }
            result = res;
            return;
        }