[Attempto] Are arithmetic expressions typed?

Joshua TAYLOR tayloj at cs.rpi.edu
Tue Jun 2 21:28:13 CEST 2009


Sorry to throw so much at you all at once, but I'm just working my way
through the DRS report.
In the syntax specification, arithmetic terms do not seem to typed.
I.e., "abc" + 2 would be a valid arithmetic term, by the parse:

term -> term1 -> term2 (term1_tail)
term2 -> term3 -> atomicTerm -> string (i.e., "abc")
term1_tail -> + term1
term1 -> term2 (term1_tail)
term2 -> term3 - > atomicTerm -> Integer (i.e., 2)

However, following are some examples about which combinations of
expressions and operators actually work. To summarize before the
examples,

string & string : OK
string & integer : ERROR
integer & integer : ERROR
integer + integer : OK
string + integer : ERROR
string + string : ERROR

Here are the examples.

== string & string is OK

CL-USER 112 > (ape :text "John, compute \"abc\" & \"2\"!" :solo 'drs)
"drs([], [command(drs([A], [predicate(A, compute, named('John'),
expr(&, string(abc), string(2)))-1/3]))])"

== string & integer is not OK

CL-USER 113 > (ape :text "John, compute \"abc\" & 2!" :solo 'drs)
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>

<messages>
  <message
      importance=\"error\"
      type=\"sentence\"
      sentence=\"1\"
      token=\"8\"
      value=\"John, compute &quot;abc&quot; &#38; &lt;&gt; 2!\"
      repair=\"Commas must be followed by 'and' or 'or', or must occur
at specified positions in lists, sets and commands.\"/>
  <message
      importance=\"error\"
      type=\"sentence\"
      sentence=\"1\"
      token=\"8\"
      value=\"John, compute &quot;abc&quot; &#38; &lt;&gt; 2!\"
      repair=\"This is the first sentence that was not ACE. The sign
&lt;&gt; indicates the position where parsing failed.\"/>
</messages>"

== neither is integer & integer OK

CL-USER 114 > (ape :text "John, compute 1 & 2!" :solo 'drs)
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>

<messages>
  <message
      importance=\"error\"
      type=\"sentence\"
      sentence=\"1\"
      token=\"5\"
      value=\"John, compute 1 &lt;&gt; &#38; 2!\"
      repair=\"Commas must be followed by 'and' or 'or', or must occur
at specified positions in lists, sets and commands.\"/>
  <message
      importance=\"error\"
      type=\"sentence\"
      sentence=\"1\"
      token=\"5\"
      value=\"John, compute 1 &lt;&gt; &#38; 2!\"
      repair=\"This is the first sentence that was not ACE. The sign
&lt;&gt; indicates the position where parsing failed.\"/>
</messages>"

== integer + integer is OK

CL-USER 115 > (ape :text "John, compute 1 + 2!" :solo 'drs)
"drs([], [command(drs([A], [predicate(A, compute, named('John'),
expr(+, int(1), int(2)))-1/3]))])"

== string + integer is not OK

CL-USER 116 > (ape :text "John, compute \"abc\" + 2!" :solo 'drs)
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>

<messages>
  <message
      importance=\"error\"
      type=\"sentence\"
      sentence=\"1\"
      token=\"7\"
      value=\"John, compute &quot;abc&quot; &lt;&gt; + 2!\"
      repair=\"Commas must be followed by 'and' or 'or', or must occur
at specified positions in lists, sets and commands.\"/>
  <message
      importance=\"error\"
      type=\"sentence\"
      sentence=\"1\"
      token=\"7\"
      value=\"John, compute &quot;abc&quot; &lt;&gt; + 2!\"
      repair=\"This is the first sentence that was not ACE. The sign
&lt;&gt; indicates the position where parsing failed.\"/>
</messages>"

== string + string is not OK

CL-USER 117 > (ape :text "John, compute \"abc\" + \"2\"!" :solo 'drs)
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>

<messages>
  <message
      importance=\"error\"
      type=\"sentence\"
      sentence=\"1\"
      token=\"7\"
      value=\"John, compute &quot;abc&quot; &lt;&gt; + &quot;2&quot;!\"
      repair=\"Commas must be followed by 'and' or 'or', or must occur
at specified positions in lists, sets and commands.\"/>
  <message
      importance=\"error\"
      type=\"sentence\"
      sentence=\"1\"
      token=\"7\"
      value=\"John, compute &quot;abc&quot; &lt;&gt; + &quot;2&quot;!\"
      repair=\"This is the first sentence that was not ACE. The sign
&lt;&gt; indicates the position where parsing failed.\"/>
</messages>"

None of these are urgent, I'm just reporting things as I discover them.
Best regards,
Joshua


More information about the attempto mailing list