⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pas.txt

📁 Draak is a multi-language, macro compiler, meaning all syntax and code generation is defined in a si
💻 TXT
字号:
Some notes about Pascal grammer

-= Global Macro Functions (@t $something $vn) =-

$base (@E $base)
  This basic function is to replace writing redundent code when defining the
	  basic types.  @E allows all of these to share lhs, rhs, alt, etc macros.
		By setting &'1'... to a set of data, this will do the actual work when these
		types are used.  The exact meanins of &'1'... are in the grammer file.

$subrange (!a $subrange lower upper number varname)
  This checks that a constant doesn't violate the subrange bound of numbers,
	  and throws an error if it does.

$reset (!a $reset)
  Resets the register pools.
  
$allocate (!a $a)
  Allocate a general register for use.

$deallocate (!a $d)
  Deallocate the current general register and resets the sxPack to be empty.
  
$allocateregister (!a $ar <register>) - TODO
  Allocates a specific register.  Makes sure it is ready and sets sx and regsx
    properly.

$deallocateregister (!a $dr <register>) - TODO
  Deallocate a specific register.  Resets inside the pool.  May not accually
    be done.
    
$constantif (!a $constif)
  If two items are constant expressions and are compared, use this to use
    alternate, compiler-time logic to determine the expression.

$inverse (!a $inv)
  Inverses logic.  In the case that an constant is before a variable in a
    comparison, basically allows the positions to be swapped in a comparison.
    I.e. 3 < a becomes a > 3.

$unloadContext (!a $unloadContext)
  Any contexts that may have been loaded by obj1.obj2.etc are undone by this
    procedure.

$typeFind (!a $typeFind <basicType>)
  Find the basic type of $2, translates from $u2 to word, etc.  Returns in 
    &'typeFind'  &'sizeFind' is set to the size in bytes it is.

$sizeFind (!a $sizeFind size1, size1)
  Finds the smallest container of two sizes.  Very simple, simple function.

$clearSizeof (!a $clearSizeof)
  Clears the data that could have been set by a "!a <var> sizeof" operation.

$movsd (!a $movsd bytes)   
  Completes a movsd operation, copying data in a fast manner for known sizes.  
    $2 is how many bytes to copy from es:di to ds:si

$pack (!a $pack (sxPack | new | begin) )
  Packs a sxPack, leaving it unpacked when it's done.  Using the new parameter,
    it will create a new sxPack and fill it with values of sx, regsx, etc.
    Using the begin parameter will start the numbering sequence.  If no 
    parameters are given, the &'sxPack' var is used, otherwise the indicated
    sxPack is used.

$unpack (!a $unpack sxPack)
  Unpacks a sxPack, setting sx, regsx, etc to the data included in used sxPack.
    Unpack requires that a sxPack be specified in the parameters.

$balance (!a $balance var1 var2)
  Balances two sxPack's to be the same size.  The smaller is expanded to the
    larger.

$ify, $intify
  The macros that set up the byteify, wordify, cardinalify, etc type of casting.
    This function is executed when the rest of they casting is created.  intify
    is the integer (signed) version of ify (unsigned).

-= Hash Variable Namespaces =-

&'sx': Current General Register
  Apart of the register pool system.  This h-v is massivily used.  When a LHS
    of a variable is called, it stores the register that contains the variable
    in sx.  Constant numbers are stored in sx, etc.

&'regsx': Current Register Type
  An intergral part of sx, it holds the type that is contained in sx.
  '': An constant, use as is.
  'Enum': Enumerated type.
  'EnumP': Pointer to an Enum, needs defrefrenced by &'sx'^
  'Int': Integer type, also used by constants
  'IntP': Pointer to an integer, use &'sx'^
  'Float': Floating point type, also used by constants
  'FloatP': Floating point pointing to a register of sorts.
  'Array': An array.
  'record': A record
  'Ptr': A pointer
  'Raw': The refrence of a variable.

&'sxsz': Current register size
  Reports the size, in bytes, of sx.  Used in Byte/Word/DWord/ifing registers.

&'regalloc': Allocated registers
  Apart of the register pool, it is the current pushed stream of allocated
    registers.
    
&'regs': Available registers
  Apart of the register pool, it is the available, unused registers.

&'basedType': If the returned type is based on another type, and should be
  implemented just like the base type.
  
&'typeName': When creating a new type, the name of the new type.

&'debug': Debug flag
  Set if we want to debug stuff. Register allocation, deallocation, etc.

&'align': Size of alignment
  Set to align all data and structures on a 1, 2, 4 or 8 size boundries.
    x86 requires that align is set to at least 2, since the stack must be
    aligned to a word.

&'loadedContext': Set to T if a context (Record/Object/Class/Unit) has been 
  loaded onto top, and needs to be poped off.

&'diUsed': Set to T if the DI register is currently used.  


&'9': Inside of a type defination, this contains the refrencing name.
  This is important because of var types call the original type for some
  basic functions.

-= !a commands =-

$2 =  
  Pushes the data onto the stack

$2 = sizeof
  Returns the size of a variable (sizeof), what it's typed as (typed), it's element size (eSize) and
    type (eType) if applicable, and the values in it's subrange (subrange), if it exists. 

$2 = raw
  Returns a raw sxPack, including way to address it and size of it.

$2 = sxRaw
  Returns the address of it into a register, and sets up an address sxPack.

$2 = load
  Loads the context of a record or object and setups the offset h-v.
  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -