HyperDbg/hyperdbg/script-engine/python/Grammar.txt
2021-02-25 19:09:13 +03:30

114 lines
1.7 KiB
Text

# OneOpFunc1 input is a number and returns a number.
.OneOpFunc1->poi db dd dw dq str wstr sizeof neg hi low not
# OneOpFunc2 input is a number.
.OneOpFunc2->print formats disableevent enableevent
.ZeroOpFunc1->break
.VarArgFunc1->printf
.Operators->or xor and asr asl add sub mul div mod
.Registers->rax rcx rdx rbx rsp rbp rsi rdi r8 r9 r10 r11 r12 r13 r14 r15
.PseudoRegisters->pid tid proc thread peb teb ip buffer context
S->STATEMENT S'
S'->STATEMENT S'
S'->eps
STATEMENT->IF_STATEMENT
STATEMENT->ASSIGN_STATEMENT ;
STATEMENT->CALL_FUNC_STATEMENT ;
ASSIGN_STATEMENT->L_VALUE = EXPRESSION @MOV NULL
CALL_FUNC_STATEMENT->.OneOpFunc2 ( EXPRESSION @.OneOpFunc2 )
CALL_FUNC_STATEMENT->.VarArgFunc1 ( STRING @VARGSTART VA @.VarArgFunc1 )
CALL_FUNC_STATEMENT->.ZeroOpFunc1 ( @.ZeroOpFunc1 )
VA->, EXPRESSION VA
VA->eps
IF_STATEMENT->@IF_EXPRESSION if ( BOOLEAN_EXPRESSION ) { S }
BOOLEAN_EXPRESSION->eps
EXPRESSION->E1 E0'
E0'->| E1 @OR E0'
E0'->eps
E1->E2 E1'
E1'->^ E2 @XOR E1'
E1'->eps
E2->E3 E2'
E2'->& E3 @AND E2'
E2'->eps
E3->E4 E3'
E3'->>> E4 @ASR E3'
E3'->eps
E4->E5 E4'
E4'-><< E5 @ASL E4'
E4'->eps
E5->E6 E5'
E5'->+ E6 @ADD E5'
E5'->eps
E6->E7 E6'
E6'->- E7 @SUB E6'
E6'->eps
E7->E8 E7'
E7'->* E8 @MUL E7'
E7'->eps
E8->E9 E8'
E8'->/ E9 @DIV E8'
E8'->eps
E9->E10 E9'
E9'->% E10 @MOD E9'
E9'->eps
E10->E12
E12->.OneOpFunc1 ( EXPRESSION @.OneOpFunc1 )
E12->( EXPRESSION )
# Types must have '_' at the first
E12->@PUSH _register
# numbers
E12->@PUSH _hex
E12->@PUSH _decimal
E12->@PUSH _octal
E12->@PUSH _binary
E12->@PUSH _pseudo_register
E12->- E12 @NEG E13
E12->+ E12 E13
E12->~ E12 @NOT E13
E13->eps
STRING->@PUSH _string
L_VALUE->@PUSH _id
L_VALUE->@PUSH _register
NULL->eps