# converts addresses in [] to gas style
# doesn't support segment override
# only quite simple expressions, and only one way
# like 5+4*ecx won't work, but ecx*4+5 will, add more if you need
-
<mathnum>
($<mathnum>)
-
<reg>
(%<reg>)
-
# gas doesn't optimize [reg + 0] to [reg]
<reg> <+-> 0
(%<reg>)
-
<reg> + <mathnum>
<mathnum>(%<reg>)
-
<reg> - <mathnum>
-<mathnum>(%<reg>)
-
<reg1> + <reg2>
(%<reg1>,%<reg2>,)
-
<reg1> + <reg2> <+-> <mathnum>
<sgn><mathnum>(%<reg1>,%<reg2>,)
-
<reg> * <dec>
(,%<reg>,<dec>)
-
<reg1> + <reg2> * <dec>
(%<reg1>,%<reg2>,<dec>)
-
<reg1> + <dec> * <reg2>
(%<reg1>,%<reg2>,<dec>)
-
# <+-> doesn't work after <dec>
#<reg> * <dec> <+-> <mathnum>
#<sgn><mathnum>(,%<reg>,<dec>)
#-
#<reg1> + <reg2> * <dec> <+-> <mathnum>
#<sgn><mathnum>(%<reg1>,%<reg2>,<dec>)
#-

# gas doesn't optimize the 0 away
<reg1> + <reg2> * <dec>+ 0
(%<reg1>,%<reg2>,<dec>)
-
<reg1> + <reg2> * <dec>+ <mathnum>
<mathnum>(%<reg1>,%<reg2>,<dec>)
-
<reg1> + <reg2> * <dec>- <mathnum>
-<mathnum>(%<reg1>,%<reg2>,<dec>)
-
<reg> + <text>
<text>(%<reg>)
-
<reg> * <dec> + <text>
<text>(,%<reg>,<dec>)
-

<text>+ <reg> * <dec>+ <mathnum>
<text>+<mathnum>(,%<reg>,<dec>)
-
<text>+ <reg> * <dec>
<text>(,%<reg>,<dec>)
-

# WARNING! This matches everything
# if the correct syntax was not found before, i2g will output incorrect code
<text>
<text>