On 1/3/2013 6:25 PM, Grant Edwards wrote:
I've written a small assembler in Python 2.[67], and it needs to evaluate integer-valued arithmetic expressions in the context of a symbol table that defines integer values for a set of names. The "right" thing is probably an expression parser/evaluator using ast, but it looked like that would take more code that the rest of the assembler combined, and I've got other higher-priority tasks to get back to.
Will ast.literal_eval do what you want? -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list