Пример #1
0
 private void compileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (name != null)
     {
         NXCODE.Assembler a = new NXCODE.Assembler(name, Environment.UserName, asmcode);
         a.Assemble();
         a.Save(name + ".nxe");
     }
 }
Пример #2
0
        private void buildToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (name != null)
            {
                GetCode();
                Scanner s = new Scanner(code);
                s.Scan();
                tokens = s.Tokens.ToArray();
                TokenList t = new TokenList();
                foreach (Token tk in tokens)
                {
                    t.listBox1.Items.Add(tk.type.ToString() + " : " + tk.val.ToString());
                }
                t.MdiParent = this;
                t.Show();
                if (tokens != null)
                {
                    Parser p = new Parser(tokens);
                    p.Parse();
                    stmts = p.Result;

                    AST_Viewer a = new AST_Viewer();

                    foreach (ISTMT st in stmts)
                    {
                        a.treeView1.Nodes.Add(st.ToNode());
                    }

                    a.MdiParent = this;
                    a.Show();
                }
                StringBuilder asmb = new StringBuilder();
                asmb.AppendLine("call main\n\r");
                asmb.AppendLine("terminate\n\r");
                foreach (ISTMT st in stmts)
                {
                    asmb.Append(st.ToAssembly());
                }
                asmcode = asmb.ToString();
                CodeViewer v = new CodeViewer();
                v.textBox1.Text = asmcode;
                v.MdiParent = this;
                v.Show();
                NXCODE.Assembler asm = new NXCODE.Assembler(name, Environment.UserName, asmcode);
                asm.Assemble();
                asm.Save(name + ".nxe");
            }
        }
Пример #3
0
        private void buildToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (name != null)
            {
                GetCode();
                Scanner s = new Scanner(code);
                s.Scan();
                tokens = s.Tokens.ToArray();
                TokenList t = new TokenList();
                foreach (Token tk in tokens)
                {
                    t.listBox1.Items.Add(tk.type.ToString() + " : " + tk.val.ToString());
                }
                t.MdiParent = this;
                t.Show();
                if (tokens != null)
                {
                    Parser p = new Parser(tokens);
                    p.Parse();
                    stmts = p.Result;

                    AST_Viewer a = new AST_Viewer();

                    foreach (ISTMT st in stmts)
                    {
                        a.treeView1.Nodes.Add(st.ToNode());
                    }

                    a.MdiParent = this;
                    a.Show();
                }
                StringBuilder asmb = new StringBuilder();
                asmb.AppendLine("call main\n\r");
                asmb.AppendLine("terminate\n\r");
                foreach (ISTMT st in stmts)
                {
                    asmb.Append(st.ToAssembly());
                }
                asmcode = asmb.ToString();
                CodeViewer v = new CodeViewer();
                v.textBox1.Text = asmcode;
                v.MdiParent     = this;
                v.Show();
                NXCODE.Assembler asm = new NXCODE.Assembler(name, Environment.UserName, asmcode);
                asm.Assemble();
                asm.Save(name + ".nxe");
            }
        }
Пример #4
0
 private void compileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (name != null)
     {
         NXCODE.Assembler a = new NXCODE.Assembler(name, Environment.UserName, asmcode);
         a.Assemble();
         a.Save(name + ".nxe");
     }
 }