Tuple parsing bug.

27 views
Skip to first unread message

aditya siram

unread,
Jan 3, 2019, 7:57:58 AM1/3/19
to ats-lang-users
Hi,
The following seems like a bug, a tuple template parameter can't be parsed. The following:

fun {a: t0p}{b : t0p} id(i : b) = i
implement main0
(argc,argv) =
  let
    val _
= id<int><@(int,int)>((1,2))
 
in
   
()
 
end



generates the error:

... 1596(line=69, offs=19) -- 1599(line=69, offs=22): error(2): the static identifier [><@] is unrecognized.
... 1593(line=69, offs=16) -- 1608(line=69, offs=31): error(2): none of the static constants referred to by [int] is applicable.
patsopt
(TRANS2): there are [2] errors in total.
exit(ATS): uncaught exception: ...




But if I add a space before the '@' it works:

implement main0
(argc,argv) =
  let
    val _
= id<int>< @(int,int)>((1,2)) (* note the space before '@' *)
 
in
   
()
 
end


Thanks!

Artyom Shalkhakov

unread,
Jan 3, 2019, 8:15:46 AM1/3/19
to ats-lang-users
чт, 3 янв. 2019 г. в 14:58, aditya siram <aditya...@gmail.com>:
It's a known issue, but thanks for highlighting it. Enclosing @(int,int) in parentheses should also work.


Thanks!

--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/d0a0a8e5-fccf-4840-af60-505e55998dcc%40googlegroups.com.


--
Cheers,
Artyom Shalkhakov

Hongwei Xi

unread,
Jan 3, 2019, 8:35:31 AM1/3/19
to ats-lan...@googlegroups.com
Following the C++ tradition, ATS uses '<' and '>'
for grouping template parameters. This caused
all sorts of lexical issues.

Note that '<@' is treated as a symbolic identifier.
You could just drop '@' to make your code work.


--
Reply all
Reply to author
Forward
0 new messages