Package litil

Examples of litil.TypeScope.define()


            List<Type> argTypes = new ArrayList<Type>();

            for (Named arg : lam.args) {
                Type argType = new Type.Variable();
                argTypes.add(argType);
                newEnv.define(arg.name, argType);
                newNonGen.add(argType);
            }
            Type resultType = null;
            for (Instruction instr : lam.instructions) {
                resultType = analyze(instr, newEnv, newNonGen);
View Full Code Here


            Set<Type> newNonGen = new HashSet<Type>(nonGen);
            List<Type> argTypes = new ArrayList<Type>();
            Type.Variable letTypeVar = new Type.Variable();

            //should a function be polymorphic to itself ?
            newEnv.define(let.name, letTypeVar);
            newNonGen.add(letTypeVar);
            for (Named arg : let.args) {
                Type argType = new Type.Variable();
                argTypes.add(argType);
                newEnv.define(arg.name, argType);
View Full Code Here

            newEnv.define(let.name, letTypeVar);
            newNonGen.add(letTypeVar);
            for (Named arg : let.args) {
                Type argType = new Type.Variable();
                argTypes.add(argType);
                newEnv.define(arg.name, argType);
                newNonGen.add(argType);
            }
            Type resultType = null;
            for (Instruction instr : let.instructions) {
                resultType = analyze(instr, newEnv, newNonGen);
View Full Code Here

            return thenType;
        } else if (node instanceof LetBinding) {
            LetBinding let = (LetBinding) node;
            TypeScope ss = new TypeScope(scope);
            List<Type> argTypes = new ArrayList<Type>();
            ss.define(let.name, new Type.Variable());

            for (Named arg : let.args) {
                Type argType = new Type.Variable();
                argTypes.add(argType);
                ss.define(arg.name, argType);
View Full Code Here

            ss.define(let.name, new Type.Variable());

            for (Named arg : let.args) {
                Type argType = new Type.Variable();
                argTypes.add(argType);
                ss.define(arg.name, argType);
            }
            Type resultType = null;
            for (Instruction instr : let.instructions) {
                resultType = analyze(instr, ss);
            }
View Full Code Here

        prtDbg = false;
    }

    private static TypeScope trootScope() {
        TypeScope res = new TypeScope();
        res.define("+", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("add", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        //res.define("-", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("*", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        //res.define("/", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        //res.define("%", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
View Full Code Here

    }

    private static TypeScope trootScope() {
        TypeScope res = new TypeScope();
        res.define("+", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("add", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        //res.define("-", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("*", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        //res.define("/", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        //res.define("%", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        //res.define("=", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.BOOL));
View Full Code Here

    private static TypeScope trootScope() {
        TypeScope res = new TypeScope();
        res.define("+", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("add", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        //res.define("-", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("*", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        //res.define("/", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        //res.define("%", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        //res.define("=", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.BOOL));

        //res.define("int2str", Type.Function(Type.INT, Type.STR));
View Full Code Here

        return p;
    }

    private TypeScope rootScope() {
        TypeScope res = new TypeScope();
        res.define("+", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("-", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("*", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("/", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("%", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("=", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.BOOL));
View Full Code Here

    }

    private TypeScope rootScope() {
        TypeScope res = new TypeScope();
        res.define("+", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("-", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("*", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("/", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("%", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.INT));
        res.define("=", Type.Function(Arrays.asList(Type.INT, Type.INT), Type.BOOL));

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.