Closed master-q closed 9 years ago
Kiwamu Okabe
Is it correct that patsopt creates .c file while the .dats file occurs type error?
$ rm -f hoge.c
casper$ cat hoge.dats
implement main0 (a) = println! ("Hello world!")
casper$ patsopt -o hoge.c -d hoge.dats
/home/kiwamu/tmp/hoge.dats: 11(line=1, offs=11) -- 48(line=1,
offs=48): error(2): there is no suitable dynamic constant declared for
[main0].
TRANS2: there are [1] errors in total.
exit(ATS): uncaught exception:
_2home_2kiwamu_2src_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)
casper$ ls -l hoge.c
-rw-r--r-- 1 kiwamu kiwamu 0 Jan 4 19:54 hoge.c
I think "hoge.c" should not be created on this case.
Hongwei
This issue requires some thoughts.
Patsopt can be used to compile several DATS files into a single C file. If Patsopt encounters a failure in the middle of a multi-file compilation, deleting the entire file may not be a good choice.
Also, I want to point out that a program in ATS may be still unable to be compiled into proper C code after the program passes typechecking. Sometimes, one needs to go over the (partially) generated C code in order to figure out what went wrong.
Shea Levy
For the Makefile issue, I suppose one can work around it by compiling to a temporary file and moving to the real file if compilation succeeds (all in the same rule of course)
Hongwei
Instead of generating an empty file, patsopt now generates a file containing one #error(...) directive if it encounters an error during typechecking, When such a file is compiled, the programmer is reminded of what went wrong. I will probably replace #error with something like PATSOPT_ERROR to make it easier for searching.
??? patsopt(TRANS3) does not return error number ???
Why auxerr(s) isn't care as error? Nonsense....
Or, we should run process_cmdline function after recovering error case?
I modified error-handling a bit. Now patsopt returns a non-zero value if it encounters an error.
I modified error-handling a bit. Please give ATS2-github a try.
Thank's a lot!
$ cat main.dats
implement main0 () = print r where {
val not_r = 0
}
$ patsopt -o main.c -d main.dats; echo $?
/home/kiwamu/tmp/main.dats: 28(line=1, offs=28) -- 29(line=1, offs=29): error(2): the dynamic identifier [r] is unrecognized.
patsopt(TRANS2): there are [1] errors in total.
exit(ATS): uncaught exception: _2home_2kiwamu_2src_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)
1
Assign me.