V2 funktioniert
This commit is contained in:
@ -622,12 +622,12 @@ public class BytecodeEmitter {
|
||||
syms[v.Name]=new Symbol{Name=v.Name,Type=v.Type,Index=idx++};
|
||||
|
||||
foreach(var v in p.Vars)
|
||||
if(v.Init!=null){EmitExpr(v.Init);EmitByte(0x03);EmitU16((ushort)syms[v.Name].Index);}
|
||||
if(v.Init!=null){EmitExpr(v.Init);EmitByte(Bytecode.OpCodes.STORE_VAR);EmitU16((ushort)syms[v.Name].Index);}
|
||||
|
||||
foreach(var s in p.Stmts)
|
||||
EmitStmt(s);
|
||||
|
||||
EmitByte(0xF0); // Program End
|
||||
EmitByte(Bytecode.OpCodes.HALT); // Program End
|
||||
}
|
||||
|
||||
// Operationscodes für verschiedene Datentypen
|
||||
@ -779,14 +779,14 @@ public class BytecodeEmitter {
|
||||
int ci = AddConst(ie.Value);
|
||||
EmitByte(Bytecode.OpCodes.PUSH_CONST); // PUSH_CONST
|
||||
EmitU16((ushort)ci);
|
||||
EmitByte((byte)ie.Type); // Typ der Konstante
|
||||
// removed emitting the type byte into code stream; type is stored with constant table
|
||||
break;
|
||||
|
||||
case RealExpr re:
|
||||
int cri = AddConst(re.Value);
|
||||
EmitByte(Bytecode.OpCodes.PUSH_REAL_CONST); // PUSH_REAL_CONST
|
||||
EmitU16((ushort)cri);
|
||||
EmitByte((byte)re.Type); // REAL oder LREAL
|
||||
// removed emitting the type byte into code stream; type is stored with constant table
|
||||
break;
|
||||
|
||||
case VarExpr ve:
|
||||
@ -808,10 +808,11 @@ public class BytecodeEmitter {
|
||||
}
|
||||
|
||||
// Wenn nötig, Typenkonvertierung vor der Operation
|
||||
if (be.L.Type != be.Type)
|
||||
EmitByte((byte)(0x50 + (int)be.Type)); // CONVERT_TO_*
|
||||
if (be.R.Type != be.Type)
|
||||
EmitByte((byte)(0x50 + (int)be.Type)); // CONVERT_TO_*
|
||||
// Conversion opcodes removed - runtime will handle type differences using constant type markers and operation opcodes
|
||||
// if (be.L.Type != be.Type)
|
||||
// EmitByte((byte)(0x50 + (int)be.Type)); // CONVERT_TO_*
|
||||
// if (be.R.Type != be.Type)
|
||||
// EmitByte((byte)(0x50 + (int)be.Type)); // CONVERT_TO_*
|
||||
|
||||
EmitByte(opCodes[key]);
|
||||
break;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,10 +13,10 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("STCompiler.Compiler")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+bdee19419dc879274e82afdd621b54e1923e0940")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("STCompiler.Compiler")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("STCompiler.Compiler")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
// Von der MSBuild WriteCodeFragment-Klasse generiert.
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
62e0a705d77d04812d8911688545c821288c02824251ca71c994335e8a831b77
|
||||
46a6144e75588781017434fbf53d108cb421bb266942aa9aa55b1dd432b3b750
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user