Esempio n. 1
0
        public CodeGen(Core coreObj, ProtoCore.DSASM.CodeBlock parentBlock = null)
        {
            Debug.Assert(coreObj != null);
            core = coreObj;
            buildStatus = core.BuildStatus;
            isEntrySet = false;

            emitReplicationGuide = false;

            dumpByteCode = core.Options.DumpByteCode;
            isAssocOperator = false;

            pc = 0;
            argOffset = 0;
            globalClassIndex = core.ClassIndex;

            context = new ProtoCore.CompileTime.Context();
            opKwData = new ProtoCore.DSASM.OpKeywordData();

            targetLangBlock = ProtoCore.DSASM.Constants.kInvalidIndex;

            enforceTypeCheck = true;

            localProcedure = core.ProcNode;
            globalProcIndex = null != localProcedure ? localProcedure.procId : ProtoCore.DSASM.Constants.kGlobalScope;

            tryLevel = 0;

            functionCallStack = new List<DSASM.ProcedureNode>();

            IsAssociativeArrayIndexing = false;

            if (core.AsmOutput == null)
            {
                if (core.Options.CompileToLib)
                {
                    string path = "";
                    if (core.Options.LibPath == null)
                    {
                        path += core.Options.RootModulePathName + "ASM";
                    }
                    else
                    {
                        path = Path.Combine(core.Options.LibPath, Path.GetFileNameWithoutExtension(core.Options.RootModulePathName) + ".dsASM");
                    }

                    core.AsmOutput = new StreamWriter(File.Open(path, FileMode.Create));
                }
                else
                {
                    core.AsmOutput = Console.Out;
                }
            }

            ssaPointerList = new List<AST.AssociativeAST.AssociativeNode>();
        }
Esempio n. 2
0
 public Parser(Scanner scanner, ProtoCore.Core coreObj, bool _builtinMethodsLoaded = false)
 {
     this.scanner = scanner;
     errors = new Errors();
     errors.core = coreObj;
     opKwData = new ProtoCore.DSASM.OpKeywordData();
     core = coreObj;
     builtinMethodsLoaded = _builtinMethodsLoaded;
     commentNode = new CodeBlockNode();
 }
Esempio n. 3
0
	public Parser(Scanner scanner, ProtoLanguage.CompileStateTracker cs, bool _builtinMethodsLoaded = false) {
		this.scanner = scanner;
		errors = new Errors();
        errors.compileState = cs;
        opKwData = new ProtoCore.DSASM.OpKeywordData();
        this.compileState = cs;
		builtinMethodsLoaded = _builtinMethodsLoaded;
        commentNode = new CodeBlockNode();
	}