コード例 #1
0
ファイル: Form1.cs プロジェクト: Northcode/NXCODE
        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");
            }
        }
コード例 #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 generateToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StringBuilder asmb = new StringBuilder();

            asmb.AppendLine("call main\n\r");
            asmb.AppendLine("terminate\n\r");
            foreach (ISTMT s in stmts)
            {
                asmb.Append(s.ToAssembly());
            }
            asmcode = asmb.ToString();
            CodeViewer v = new CodeViewer();

            v.textBox1.Text = asmcode;
            v.MdiParent     = this;
            v.Show();
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: Northcode/NXCODE
 private void generateToolStripMenuItem_Click(object sender, EventArgs e)
 {
     StringBuilder asmb = new StringBuilder();
     asmb.AppendLine("call main\n\r");
     asmb.AppendLine("terminate\n\r");
     foreach (ISTMT s in stmts)
     {
         asmb.Append(s.ToAssembly());
     }
     asmcode = asmb.ToString();
     CodeViewer v = new CodeViewer();
     v.textBox1.Text = asmcode;
     v.MdiParent = this;
     v.Show();
 }