How to call readline?

I attempted to use readline but get this error:

brand_000@ideapc
~/ats2-lang-contrib-code/contrib/libats-bbarker/readline/EXAMPLES
$ patscc.exe -IATS ~/ats2-lang-contrib-code/contrib filename_completion.dats
exec(patsopt -IATS /home/brand_000/ats2-lang-contrib-code/contrib --output
filename_completion_dats.c --dynamic filename_completion.dats)
Hello from ATS2(ATS/Postiats)!
Loading [fixity.ats] starts!
Loading [fixity.ats] finishes!
Loading [basics_pre.sats] starts!
Loading [basics_pre.sats] finishes!
Loading [basics_sta.sats] starts!
Loading [basics_sta.sats] finishes!
Loading [basics_dyn.sats] starts!
Loading [basics_dyn.sats] finishes!
Loading [basics_gen.sats] starts!
Loading [basics_gen.sats] finishes!
/home/brand_000/ats2-lang-contrib-code/contrib/libats-bbarker/readline/SATS/readline.sats:
1684(line=53, offs=31) – 1687(line=53, offs=34): error(parsing): [s0tring]
is needed
/home/brand_000/ats2-lang-contrib-code/contrib/libats-bbarker/readline/SATS/readline.sats:
1634(line=52, offs=1) – 1637(line=52, offs=4): error(parsing): the token
is discarded.
exit(ATS): uncaught exception:
_2home_2brand_000_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorException(1025)
exec(patsopt -IATS /home/brand_000/ats2-lang-contrib-code/contrib --output
filename_completion_dats.c --dynamic filename_completion.dats) = 256

Here is the code:
https://github.com/bbarker/ats2-lang-contrib-code
(and this particular version, for posterity:
https://github.com/bbarker/ats2-lang-contrib-code/tree/f1a77b3304e4330838f6e335cf9e7ca8bcfaa0ec
)

It is now working: I believe the error above may have been irrelevant. It
just took a few minor typos to fix.On Wednesday, January 8, 2014 9:47:01 PM UTC-5, Brandon Barker wrote:

Well I did spot one issue already. I had

fun readline_string
(prompt: string): String1 = mac"#%"

instead of
(prompt: string): strptr = "mac#readline

Which was at least 2 errors (wrong syntax and I need the name of the C fun
after mac# since it is different from the ATS function name.

Still I get
/home/brand_000/ats2-lang-contrib-code/contrib/libats-bbarker/readline/EXAMPLES/filename_completion.dats:
291(line=13, offs=22) – 309(line=13, offs=40): error(3): the function
argument needs to be a left-value.
TRANS3: there are [1] errors in total.

On Wednesday, January 8, 2014 9:24:49 PM UTC-5, Brandon Barker wrote:

I attempted to use readline but get this error:

brand_000@ideapc
~/ats2-lang-contrib-code/contrib/libats-bbarker/readline/EXAMPLES
$ patscc.exe -IATS ~/ats2-lang-contrib-code/contrib
filename_completion.dats
exec(patsopt -IATS /home/brand_000/ats2-lang-contrib-code/contrib
–output filename_completion_dats.c --dynamic filename_completion.dats)
Hello from ATS2(ATS/Postiats)!
Loading [fixity.ats] starts!
Loading [fixity.ats] finishes!
Loading [basics_pre.sats] starts!
Loading [basics_pre.sats] finishes!
Loading [basics_sta.sats] starts!
Loading [basics_sta.sats] finishes!
Loading [basics_dyn.sats] starts!
Loading [basics_dyn.sats] finishes!
Loading [basics_gen.sats] starts!
Loading [basics_gen.sats] finishes!
/home/brand_000/ats2-lang-contrib-code/contrib/libats-bbarker/readline/SATS/readline.sats:
1684(line=53, offs=31) – 1687(line=53, offs=34): error(parsing): [s0tring]
is needed
/home/brand_000/ats2-lang-contrib-code/contrib/libats-bbarker/readline/SATS/readline.sats:
1634(line=52, offs=1) – 1637(line=52, offs=4): error(parsing): the token
is discarded.
exit(ATS): uncaught exception:
_2home_2brand_000_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorException(1025)
exec(patsopt -IATS /home/brand_000/ats2-lang-contrib-code/contrib
–output filename_completion_dats.c --dynamic filename_completion.dats) =
256

Here is the code:
GitHub - bbarker/ats2-lang-contrib-code: ATS2 Contrib - forked from sf.net/p/ats2-lang-contrib/
(and this particular version, for posterity:

GitHub - bbarker/ats2-lang-contrib-code at f1a77b3304e4330838f6e335cf9e7ca8bcfaa0ec
)

I set up something for you quickly:

https://github.com/githwxi/ATS-Postiats/tree/master/contrib/readline

I planned to make an API in ATS for GNU-readline long time ago, but never
had
time for it. Thanks for getting it started.

For now please still work inside your own namespace: libats-bbarker. I will
gradually
move your code into to the above directory.

To save your own time, I suggest that you only handle readline-functions
you need for
your project.

Cheers!On Wednesday, January 8, 2014 10:14:32 PM UTC-5, Brandon Barker wrote:

It is now working: I believe the error above may have been irrelevant. It
just took a few minor typos to fix.

On Wednesday, January 8, 2014 9:47:01 PM UTC-5, Brandon Barker wrote:

Well I did spot one issue already. I had

fun readline_string
(prompt: string): String1 = mac"#%"

instead of
(prompt: string): strptr = "mac#readline

Which was at least 2 errors (wrong syntax and I need the name of the C
fun after mac# since it is different from the ATS function name.

Still I get
/home/brand_000/ats2-lang-contrib-code/contrib/libats-bbarker/readline/EXAMPLES/filename_completion.dats:
291(line=13, offs=22) – 309(line=13, offs=40): error(3): the function
argument needs to be a left-value.
TRANS3: there are [1] errors in total.

On Wednesday, January 8, 2014 9:24:49 PM UTC-5, Brandon Barker wrote:

I attempted to use readline but get this error:

brand_000@ideapc
~/ats2-lang-contrib-code/contrib/libats-bbarker/readline/EXAMPLES
$ patscc.exe -IATS ~/ats2-lang-contrib-code/contrib
filename_completion.dats
exec(patsopt -IATS /home/brand_000/ats2-lang-contrib-code/contrib
–output filename_completion_dats.c --dynamic filename_completion.dats)
Hello from ATS2(ATS/Postiats)!
Loading [fixity.ats] starts!
Loading [fixity.ats] finishes!
Loading [basics_pre.sats] starts!
Loading [basics_pre.sats] finishes!
Loading [basics_sta.sats] starts!
Loading [basics_sta.sats] finishes!
Loading [basics_dyn.sats] starts!
Loading [basics_dyn.sats] finishes!
Loading [basics_gen.sats] starts!
Loading [basics_gen.sats] finishes!
/home/brand_000/ats2-lang-contrib-code/contrib/libats-bbarker/readline/SATS/readline.sats:
1684(line=53, offs=31) – 1687(line=53, offs=34): error(parsing): [s0tring]
is needed
/home/brand_000/ats2-lang-contrib-code/contrib/libats-bbarker/readline/SATS/readline.sats:
1634(line=52, offs=1) – 1637(line=52, offs=4): error(parsing): the token
is discarded.
exit(ATS): uncaught exception:
_2home_2brand_000_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorException(1025)
exec(patsopt -IATS /home/brand_000/ats2-lang-contrib-code/contrib
–output filename_completion_dats.c --dynamic filename_completion.dats) =
256

Here is the code:
GitHub - bbarker/ats2-lang-contrib-code: ATS2 Contrib - forked from sf.net/p/ats2-lang-contrib/
(and this particular version, for posterity:

GitHub - bbarker/ats2-lang-contrib-code at f1a77b3304e4330838f6e335cf9e7ca8bcfaa0ec
)

Well I did spot one issue already. I had

fun readline_string
(prompt: string): String1 = mac"#%"

instead of
(prompt: string): strptr = "mac#readline

Which was at least 2 errors (wrong syntax and I need the name of the C fun
after mac# since it is different from the ATS function name.

Still I get
/home/brand_000/ats2-lang-contrib-code/contrib/libats-bbarker/readline/EXAMPLES/filename_completion.dats:
291(line=13, offs=22) – 309(line=13, offs=40): error(3): the function
argument needs to be a left-value.
TRANS3: there are [1] errors in total.On Wednesday, January 8, 2014 9:24:49 PM UTC-5, Brandon Barker wrote:

I attempted to use readline but get this error:

brand_000@ideapc
~/ats2-lang-contrib-code/contrib/libats-bbarker/readline/EXAMPLES
$ patscc.exe -IATS ~/ats2-lang-contrib-code/contrib
filename_completion.dats
exec(patsopt -IATS /home/brand_000/ats2-lang-contrib-code/contrib --output
filename_completion_dats.c --dynamic filename_completion.dats)
Hello from ATS2(ATS/Postiats)!
Loading [fixity.ats] starts!
Loading [fixity.ats] finishes!
Loading [basics_pre.sats] starts!
Loading [basics_pre.sats] finishes!
Loading [basics_sta.sats] starts!
Loading [basics_sta.sats] finishes!
Loading [basics_dyn.sats] starts!
Loading [basics_dyn.sats] finishes!
Loading [basics_gen.sats] starts!
Loading [basics_gen.sats] finishes!
/home/brand_000/ats2-lang-contrib-code/contrib/libats-bbarker/readline/SATS/readline.sats:
1684(line=53, offs=31) – 1687(line=53, offs=34): error(parsing): [s0tring]
is needed
/home/brand_000/ats2-lang-contrib-code/contrib/libats-bbarker/readline/SATS/readline.sats:
1634(line=52, offs=1) – 1637(line=52, offs=4): error(parsing): the token
is discarded.
exit(ATS): uncaught exception:
_2home_2brand_000_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorException(1025)
exec(patsopt -IATS /home/brand_000/ats2-lang-contrib-code/contrib --output
filename_completion_dats.c --dynamic filename_completion.dats) = 256

Here is the code:
GitHub - bbarker/ats2-lang-contrib-code: ATS2 Contrib - forked from sf.net/p/ats2-lang-contrib/
(and this particular version, for posterity:

GitHub - bbarker/ats2-lang-contrib-code at f1a77b3304e4330838f6e335cf9e7ca8bcfaa0ec
)