mirror of
https://github.com/HyperDbg/HyperDbg.git
synced 2026-08-09 16:44:57 +00:00
print command added.
This commit is contained in:
parent
a6d102f822
commit
a3f8df947c
8 changed files with 122 additions and 364 deletions
|
|
@ -30,7 +30,7 @@ class Parser:
|
|||
self.GrammerFile = open("Grammer.txt", "r")
|
||||
|
||||
# The file which is used by parser for parsing the input
|
||||
self.OutputFile = open("..\src\ParseTable.h", "w")
|
||||
self.OutputFile = open("..\src\parse_table.h", "w")
|
||||
|
||||
# Lists which used for storing the rules:
|
||||
# Right Hand Side(Rhs)
|
||||
|
|
@ -183,13 +183,14 @@ class Parser:
|
|||
print("2)Error in input!")
|
||||
exit()
|
||||
else:
|
||||
|
||||
Op0 = MatchedStack.pop()
|
||||
Op1 = MatchedStack.pop()
|
||||
|
||||
if Top == "@MOV":
|
||||
if Top == "@PRINT":
|
||||
print(Top,"\t", Op0 )
|
||||
elif Top == "@MOV":
|
||||
Op1 = MatchedStack.pop()
|
||||
print(Top,"\t", Op1, ", ", Op0 )
|
||||
else:
|
||||
Op1 = MatchedStack.pop()
|
||||
MatchedStack.append("t" + str(TempCounter))
|
||||
print(Top, "\t", "t"+ str(TempCounter), ", ", Op1, ",", Op0 )
|
||||
TempCounter += 1
|
||||
|
|
@ -600,6 +601,6 @@ class Parser:
|
|||
|
||||
parser = Parser()
|
||||
parser.Run()
|
||||
Tokens = ['_id', '=', '(', '_hex', '*', '_hex', ')', '*', '_hex', '*', '_decimal', '*', '_octal', ';', '$']
|
||||
Tokens = ['print', '(', '_hex', ')', ';', '$']
|
||||
Stack = parser.Parse(Tokens)
|
||||
print(Stack)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue