Web版x86エミュレータの入力にNASMが使えるといいなと思い、アセンブラを実装中。トークンへの分割はできつつある、目指せアセンブラ!以下に自作字句解析プログラムの出力結果を載せておく
入力
MOV AX, 0x1000 ADD AX, 0x2000 end: JMP end DB "Hello World!", 0x0A, 0
自作字句解析プログラムの出力結果
Text = MOV Type = Instruction Text = AX Type = Register16 Text = , Type = Separator Text = 1000 Type = Number Text = ADD Type = Instruction Text = AX Type = Register16 Text = , Type = Separator Text = 2000 Type = Number Text = end: Type = Unknown Text = JMP Type = Instruction Text = end Type = Unknown Text = DB Type = Data Text = Hello World! Type = String Text = , Type = Separator Text = 0A Type = Number Text = , Type = Separator Text = 0 Type = Number