從零開始編寫程式語言/結構
外觀
結構是在連續位置的一組不同型別的資料。它必然是將不同型別的資料組合在一起。
Defstruct [Name of structure]{
.
.
.
}
彙編格式
[Name of structure] struct starts .
.
.
[Name of structure] ends
1.If keyword defstruct then
2.While char not { get char and store in array name
3.Write to output file format as given above.
[注意關鍵字的選擇完全取決於你。]
所有結構在物理記憶體中沒有代表的情況下都是無用的。這被稱為結構變數。
結構變數與其他變數一起定義,但重要的是結構變數在初始化時沒有定義(至少在彙編中是這樣)。 因此我們將只處理未初始化的結構變數。
彙編格式
[structure variable name] [parent structure name] <?>
<?> 是結構重複運算子,它將值 0 或 0.0 設定為所有子元件
1.If keyword struct then 2.Scan parent structure name [Duplicate algorithm for getting simple variables] 3.Write to file in format as given above.
在 HLL 中
defstruct boy{
int age,grade;
float marks;
char name[20];
}
在彙編中
boy struct starts age dword ? grade dword ? marks real8 ? name byte 19 dup (?),0 boy ends