ATS3: For constructing quality code productively
1. Correctness through advanced types
2. Productivity through code sharing and meta-programming
Right now, there is not yet a compiler from ATS3 to C.
I am still in the process of designing an intermediate
language for compiling to C/C++.
We can compile ATS3 to JavaScript and also to Python3.
For this release, I will just push out a compiler from ATS3
to JS (ATS3-to-JS-in-ATS3). This compiler has been successfully
bootstrapped in the sense that it can compile its own source, which
for now consists of about 160K lines written in ATS3.
By the way, the first compiler for ATS3 is ATS3-to-JS-in-ATS2, which
consists of about 120K lines written in ATS2 (ATS-Postiats).
What I will push out is a big file of JS code that you can use node
(or nodejs) to run to compile ATS3 programs. Yes, you can use 'bun'
to run it, too. For now, we will focus on using 'node'. In the future, we
may even use Quick JS (QJS) by Fabrice Bellard to run the file.
Programming in ATS3 as of now is likely a very different programming
experience. Please be patient. In a nutshell, an ATS3 program can contain
many templates; the compiler fetches the code for these templates; in the
fetched code, there can be further templates, and the compiler does template
resolution recursively. And the programmer writes code to affect the outcome
of template resolution. If you have experience with C++ templates; it helps. If
you are familiar with type classes in Haskell, it helps, too.
If one programmer implements some templates and another puts them on
the search path of the compiler, then code sharing happens. Templates are
different from library functions in one big sense: the user of a template can
write code to modify the template from the outside.
There will be many many more new concepts on the way. Hopefully, learning
ATS3 can become an enlightening journey for you. If you would like to help
enlighten others by posting something here or elsewhere, please be my guest.
Cheers!
Hongwei Xi