Browsable Borland Delphi Assembler Grammar

CC-BY

Grammar extracted by Vadim Zaytsev, see the Grammar Zoo entry for details: assembly/delphi/txl/cangas/extracted
Source used for this grammar: Jorge L. Cangas, TXL Grammar for Borland Delphi 2006, asm.grammar, December 2007

Summary

Syntax

asm_stmtblock ::=
	"asm" asm_stm* end_struct
asm_stm ::=
	asmlabel_colon? asm_unlabeledstm_semi?
asmlabel_colon ::=
	asmlabel colon
asm_unlabeledstm_semi ::=
	asm_unlabeledstm ";"? NL
asmid ::=
	"@"* asmlbl
	"@+"* id
	"@+"* anynumber
	"@+"* key
asmlabel ::=
	SPOFF asmid+ SPON
	label_id
asm_expr ::=
	asm_term asm_infix_expr*
asm_infix_expr ::=
	asm_infixop asm_term
asm_term ::=
	asm_prefixop* asm_primary asm_postfixop*
asm_primary ::=
	"[" asm_expr "]"
	"(" asm_expr ")"
	asm_register
	id
	anynumber
	charlit
	stringlit
	asmhex
	SP asmlabel
asmhex ::=
	number SPOFF id SPON
asm_unlabeledstm ::=
	asm_directive {asm_directive_arg ","}*
	asm_opcode_prefix? asm_opcode {asm_expr ","}*
asm_opcode_prefix ::=
	"lock" space?
asm_opcode ::=
	"adc"
	"add"
	"and"
	"bswap"
	"bt"
	"btr"
	"bts"
	"call"
	"cdq"
	"cld"
	"cmp"
	"dec"
	"div"
	"f2xm1"
	"fabs"
	"fadd"
	"faddp"
	"fbstp"
	"fchs"
	"fclex"
	"fcom"
	"fcomp"
	"fcos"
	"fdiv"
	"fdivp"
	"fdivrp"
	"ffree"
	"fiadd"
	"fidiv"
	"fild"
	"fimul"
	"fistp"
	"fld"
	"fld1"
	"fldcw"
	"fldl2e"
	"fldlg2"
	"fldln2"
	"fldz"
	"fmul"
	"fmulp"
	"fnclex"
	"fninit"
	"fnstcw"
	"fnstsw"
	"fpatan"
	"fprem"
	"fptan"
	"frndint"
	"fscale"
	"fsin"
	"fsincos"
	"fsqrt"
	"fstcw"
	"fstp"
	"fstsw"
	"fsub"
	"fsubp"
	"fsubr"
	"fwait"
	"fxch"
	"fxtract"
	"fyl2x"
	"fyl2xp1"
	"imul"
	"inc"
	"int"
	"ja"
	"jae"
	"jb"
	"jbe"
	"jc"
	"je"
	"jecxz"
	"jg"
	"jge"
	"jl"
	"jle"
	"jmp"
	"jnc"
	"jne"
	"jnl"
	"jns"
	"jnz"
	"jo"
	"jp"
	"js"
	"jz"
	"lea"
	"leave"
	"lodsb"
	"lodsw"
	"loop"
	"mov"
	"movsb"
	"movsx"
	"movzx"
	"mul"
	"neg"
	"not"
	"or"
	"pop"
	"popfd"
	"push"
	"pushfd"
	"rcl"
	"rcr"
	"rep"
	"repe"
	"repne"
	"ret"
	"rol"
	"ror"
	"sahf"
	"sar"
	"sbb"
	"seto"
	"shl"
	"shld"
	"shr"
	"shrd"
	"std"
	"stosb"
	"stosd"
	"stosw"
	"sub"
	"test"
	"wait"
	"xadd"
	"xchg"
	"xor"
asm_directive ::=
	"DB"
	"DW"
	"DD"
	"DQ"
asm_directive_arg ::=
	charlit
	sign? anynumber
	asm_expr
asm_register ::=
	"ST" "(" integernumber ")"
	"ST"
	"FS"
	"GS"
	"EAX"
	"EBX"
	"ECX"
	"EDX"
	"ESP"
	"EBP"
	"ESI"
	"EDI"
	"AX"
	"BX"
	"CX"
	"DX"
	"SP"
	"BP"
	"SI"
	"DI"
	"AL"
	"BL"
	"CL"
	"DL"
	"CS"
	"DS"
	"SS"
	"ES"
	"AH"
	"BH"
	"CH"
	"DH"
	"CS" segmt_overr?
	"DS" segmt_overr?
	"SS" segmt_overr?
	"FS" segmt_overr?
	"GS" segmt_overr?
	"ES" segmt_overr?
segmt_overr ::=
	SPOFF ":" asm_expr SPON
asm_prefixop ::=
	"high"
	"low"
	"offset"
	"dmtindex"
	"vmtoffset"
	"type"
	"not"
	"&"
	sign
	"@"
asm_infixop ::=
	"."
	"+"
	"-"
	"*"
	"/"
	"ptr"
	"mod"
	"xor"
	"and"
	"or"
	"shr"
	"shl"
asm_postfixop ::=
	"[" asm_expr "]"
	"." asm_expr
procedure_body ::=
	asm_stmtblock
unlabeled_stm ::=
	asm_stmtblock

GrammarLabMaintained by Dr. Vadim Zaytsev a.k.a. @grammarware. Last updated in September 2015. []