예제 #1
0
        public override AST.Node ToAST(Env env)
        {
            if (Id.IsReservedIdentifier(id.symbol))
            {
                throw new EReservedIdentifier(Pos, id.symbol);
            }
            if (env.GetLable(id.symbol) != null)
            {
                throw new ERedfineLabel(Pos, id.symbol);
            }
            string transformed = env.AddLabel(id.symbol);

            return(new AST.Labeled(transformed, stmt.ToAST(env)));
        }
예제 #2
0
        public override AST.Node ToAST(Env env)
        {
            if (Id.IsReservedIdentifier(label))
            {
                throw new EReservedIdentifier(Pos, label);
            }

            string rename = env.GetLable(label);

            if (rename == null)
            {
                throw new EUndefinedIdentifier(Pos, label);
            }

            return(new AST.GoTo(rename));
        }