Missing definition(s) or macro(s) in generated C file

Hi all,

Trying to compile this short sample:

fun fact {n: nat} .. (x: int n): int =
if x > 0
then x * fact (x - 1)
else 1

I get these errors (shortened version of the full output, for readability):

[…] In function ‘fact_0’:
[…] ‘PMVtmpltcstmat’ undeclared (first use in this function)
[…] ‘gt_g1int_int’ undeclared (first use in this function)
[…] expected expression before ‘atstype_int’
[…] expected expression before ‘)’ token
[…] ‘g1int_sub’ undeclared (first use in this function)
[…] expected expression before ‘atstype_int’
[…] expected expression before ‘)’ token
[…] ‘g0int_mul’ undeclared (first use in this function)
[…] expected expression before ‘atstype_int’
[…] expected expression before ‘)’ token

There are errors looking like syntax errors to the C compiler (which is
GCC), which in turn makes me suppose it may be due to missing macro(s) (I
don’t like C macros, and this kind of errors is one of the reason why).

May be I need to add a -Dxxx option to the command line when invoking
patscc, but which one? Or is this another kind of issue?

This also seems FAQ-worthy:

Brandon Barker
brandon…@gmail.comOn Sat, Aug 9, 2014 at 5:00 PM, gmhwxi gmh...@gmail.com wrote:

Seems prelude needs it, so why isn’t it automatically included?

Because it is not needed for everyone. Say you want to do kernel
programming.

ATS is a very versatile language. The more you use it, the more you will
find it out :slight_smile:

On Saturday, August 9, 2014 4:25:37 PM UTC-4, Yannick Duchêne wrote:

Le samedi 9 août 2014 21:47:12 UTC+2, Brandon Barker a écrit :

I think you may need to #include “share/atspre_staload.hats”

Indeed. I though all basic things were part of prelude.

About the prelude, the *.hats file mentions it, as starts with this
comment:

(*
** This is mostly for staloading
** template code in ATSLIB/prelude
*)

Seems prelude needs it, so why isn’t it automatically included?

I will start everything with this include, unless there are known case
where it should not be included.


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 http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/c631b140-71c2-41da-b129-9836eb5f8de2%40googlegroups.com.

When going for a compile (as opposed to the typecheck only) it may be
helpful to post the entire file being compiled (and maybe you did -
just wanted to verify).
Brandon Barker
brandon…@gmail.comOn Sat, Aug 9, 2014 at 3:46 PM, Brandon Barker brandon...@gmail.com wrote:

I think you may need to #include “share/atspre_staload.hats”

Brandon Barker
brandon...@gmail.com

On Sat, Aug 9, 2014 at 3:18 PM, ‘Yannick Duchêne’ via ats-lang-users ats-lan...@googlegroups.com wrote:

Hi all,

Trying to compile this short sample:

fun fact {n: nat} .. (x: int n): int =
if x > 0
then x * fact (x - 1)
else 1

I get these errors (shortened version of the full output, for readability):

[…] In function ‘fact_0’:
[…] ‘PMVtmpltcstmat’ undeclared (first use in this function)
[…] ‘gt_g1int_int’ undeclared (first use in this function)
[…] expected expression before ‘atstype_int’
[…] expected expression before ‘)’ token
[…] ‘g1int_sub’ undeclared (first use in this function)
[…] expected expression before ‘atstype_int’
[…] expected expression before ‘)’ token
[…] ‘g0int_mul’ undeclared (first use in this function)
[…] expected expression before ‘atstype_int’
[…] expected expression before ‘)’ token

There are errors looking like syntax errors to the C compiler (which is
GCC), which in turn makes me suppose it may be due to missing macro(s) (I
don’t like C macros, and this kind of errors is one of the reason why).

May be I need to add a -Dxxx option to the command line when invoking
patscc, but which one? Or is this another kind of issue?


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 http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/70a505ec-6d89-4cca-96ca-82e2b1252fbc%40googlegroups.com.

I think you may need to #include “share/atspre_staload.hats”

Brandon Barker
brandon…@gmail.comOn Sat, Aug 9, 2014 at 3:18 PM, ‘Yannick Duchêne’ via ats-lang-users ats-lan...@googlegroups.com wrote:

Hi all,

Trying to compile this short sample:

fun fact {n: nat} .. (x: int n): int =
if x > 0
then x * fact (x - 1)
else 1

I get these errors (shortened version of the full output, for readability):

[…] In function ‘fact_0’:
[…] ‘PMVtmpltcstmat’ undeclared (first use in this function)
[…] ‘gt_g1int_int’ undeclared (first use in this function)
[…] expected expression before ‘atstype_int’
[…] expected expression before ‘)’ token
[…] ‘g1int_sub’ undeclared (first use in this function)
[…] expected expression before ‘atstype_int’
[…] expected expression before ‘)’ token
[…] ‘g0int_mul’ undeclared (first use in this function)
[…] expected expression before ‘atstype_int’
[…] expected expression before ‘)’ token

There are errors looking like syntax errors to the C compiler (which is
GCC), which in turn makes me suppose it may be due to missing macro(s) (I
don’t like C macros, and this kind of errors is one of the reason why).

May be I need to add a -Dxxx option to the command line when invoking
patscc, but which one? Or is this another kind of issue?


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 http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/70a505ec-6d89-4cca-96ca-82e2b1252fbc%40googlegroups.com.

Seems prelude needs it, so why isn’t it automatically included?

Because it is not needed for everyone. Say you want to do kernel
programming.

ATS is a very versatile language. The more you use it, the more you will
find it out :)On Saturday, August 9, 2014 4:25:37 PM UTC-4, Yannick Duchêne wrote:

Le samedi 9 août 2014 21:47:12 UTC+2, Brandon Barker a écrit :

I think you may need to #include “share/atspre_staload.hats”

Indeed. I though all basic things were part of prelude.

About the prelude, the *.hats file mentions it, as starts with this
comment:

(*
** This is mostly for staloading
** template code in ATSLIB/prelude
*)

Seems prelude needs it, so why isn’t it automatically included?

I will start everything with this include, unless there are known case
where it should not be included.

I think you may need to #include “share/atspre_staload.hats”

Indeed. I though all basic things were part of prelude.

About the prelude, the *.hats file mentions it, as starts with this comment:

(*
** This is mostly for staloading
** template code in ATSLIB/prelude
*)

Seems prelude needs it, so why isn’t it automatically included?

I will start everything with this include, unless there are known case
where it should not be included.

I think you are right that prelude is staloaded (don’t quote me on
this for sure), but there are two kinds of staload:

And I think it is only the first kind that patscc or patsopt does by default.
Brandon Barker
brandon…@gmail.comOn Sat, Aug 9, 2014 at 4:25 PM, ‘Yannick Duchêne’ via ats-lang-users ats-lan...@googlegroups.com wrote:

Le samedi 9 août 2014 21:47:12 UTC+2, Brandon Barker a écrit :

I think you may need to #include “share/atspre_staload.hats”

Indeed. I though all basic things were part of prelude.

About the prelude, the *.hats file mentions it, as starts with this comment:

(*
** This is mostly for staloading
** template code in ATSLIB/prelude
*)

Seems prelude needs it, so why isn’t it automatically included?

I will start everything with this include, unless there are known case where
it should not be included.


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 http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/c163584c-b655-4ec5-b0a7-f474e3228f9c%40googlegroups.com.