On 03/11/2010 06:42 PM, Felix Lawrence wrote:
FullForm looks like a bit of a headache to me - in part one of the
examples given, InputForm gives Sqrt[5], whereas FullForm gives
Power[5,Rational[-1,2]].  The former is closer to sage's syntax and
should be easier to parse (and a basic parser for InputForm already
exists, in _sage_repr().)  So I'm not yet convinced that FullForm is
the way to go.



And yet on a lower level, Sage does exactly the equivalent of FullForm (I assume you mean Power[5,Rational[1,2]], without the negative sign---otherwise it would be a very embarrassing bug in MMA).

sage: a=sqrt(5)
sage: a.operator()
<built-in function pow>
sage: a.operands()
[5, 1/2]

So the Mathematica *input* syntax is closer to the sage *input* syntax, while the mathematica full form (i.e., the internal tree of operations) is closer to the sage tree of operations. That makes a lot of sense. For software<->software translation, in the long run, it will probably make more sense to hook up the two operation trees, rather than deal with the sometimes vague output printing of one going into the input printing of the other.

So we just need to hook the mathematica into a lower level of Sage (at the pynac level) where the expressions are more consistent.

I published a proof-of-concept translator from SR -> MMA here:

http://sagenb.org/home/jason3/383/publish/

I think using the expression trees is much better (i.e., lower-level, and less error-prone) than dealing with the human-friendly input formats.

Thanks,

Jason

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to