t[0] = t[1] + [t[3]]
def p_print_format0(t):
'statement : PRINT_FORMAT NAME'
- t[0] = ('print', t[3])
+ t[0] = ('print', t[2])
## R
def p_remark1(t):
# Generate code
if arguments == ['-']:
generate(sys.stdout)
+ sys.exit(0)
+
+ if not target and len(arguments) == 1:
+ target = arguments[0][:-4]
elif not target and len(arguments) > 1:
sys.stderr.write("mad: -o is required with multiple sourcefiles.\n")
sys.exit(1)
- else:
- out = open(target + ".c", "w")
- generate(out)
- out.close()
- if binary:
- # Must be gcc, else compilation of internal functions will fail
- if hasmain:
- if not target:
- target = arguments[0][:-4]
- compile = "gcc -std=c99 %s.c -lm -o %s" % (target, target)
- else:
- if not target:
- target = arguments[0][:-4] + ".o"
- compile = "gcc -std=c99 -c %s.c -o %s" % (target, target)
- if os.system(compile) == 0:
- os.system("rm -f " + target + ".c")
+ out = open(target + ".c", "w")
+ generate(out)
+ out.close()
+ if binary:
+ # Must be gcc, else compilation of internal functions will fail
+ if hasmain:
+ if not target:
+ target = arguments[0][:-4]
+ compile = "gcc -std=c99 %s.c -lm -o %s" % (target, target)
+ else:
+ if not target:
+ target = arguments[0][:-4] + ".o"
+ compile = "gcc -std=c99 -c %s.c -o %s" % (target, target)
+ if os.system(compile) == 0:
+ os.system("rm -f " + target + ".c")
# end