Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Making a Programming Language From Scratch/Structures

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Structural declarations Structures are groups of different types of data in continuous locations. It is necessarily the grouping of different types of data together. Format of structural declarations Defstruct [Name of structure]{ . . . } Format of assembly: [Name of structure] struct starts . . . [Name of structure] ends Algorithm to process 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. [note that choice of keyword is totally up to you.] Structure variable declarations All structures are useless unless they have some representatives in the physical memory. This is called a structure variable. A structure variable is defined along with other variables with the important difference that structure variables are not defined during initializing (at least in assembly). Thus we will deal with only uninitialized structure variables. Format as of assembly: [structure variable name] [parent structure name] <?> The <?> is the structure dup operator which sets value 0 or 0.0 to all sub-components Algorithm 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. Sample Conversion In HLL defstruct boy{ int age,grade; float marks; char name[20]; } In Assembly boy struct starts age dword ? grade dword ? marks real8 ? name byte 19 dup (?),0 boy ends