i’d hope that ATS could (some day) take a minute to gather stock and
see if there could be some unifying strategies here.
Certainly!
The current target language for ATS.Postiats makes essential use of
goto statements. It makes sense to first translate the target language into
another one that does not involve ny goto statements. In this way, targeting
languages that do not support goto statements can be made a lot easier.
Python makes things a bit harder because it does not even support switch
statements directly.On Monday, August 18, 2014 2:52:58 PM UTC-4, Raoul Duke wrote:
Alignment and documentation will come later if they do come. It is in
general very difficult to get a good software product during the first
try.
Iterations are often needed.
of course, hear hear. too much early ‘standardization’ slows down the
experimenting too much.
still, having looked and and used some other languages that have
multiple back-ends $0.02:
so one of the ways in which Shen does a better job than I think Haxe
is that Shen tries to have a quite small kernel language. then the
full language sits on top of it, and target languages sit underneath.
it has benefits and drawbacks, of course.
that is the kind of thing that I think would be interesting for ATS
people to talk about. I see the way Haxe has gone and frankly when I
use it, I see that it is a big fat lie in so many ways e.g. the Java
back end is (historically maybe less so now) drastically and rather
dishonestly incomplete.
i’d hope that ATS could (some day) take a minute to gather stock and
see if there could be some unifying strategies here.
And another question: I’d like to separate arguments from local variables
(for IL has different instructions for handling those); currently the code
will check the symbol string (if it starts with “arg”, then it’s an
argument).
Forgot to answer this one.
Yes, checking if the name begins with ‘arg’ is the right way to do it.
staload STRING = “libc/SATS/string.sats”
fun symbol_is_arg (x: symbol): bool =
$STRING.strncmp (symbol_get_name(x), “arg”, i2sz(3))On Tuesday, August 19, 2014 12:11:52 AM UTC-4, Artyom Shalkhakov wrote:
On Monday, August 18, 2014 10:22:56 PM UTC+6, gmhwxi wrote:
Yes, another pass.
You can introduce another type instr2 for instructions and then translate
instr to instr2.
OK. One more question: what’s the difference between d0exp (dynamic
expressions?) and instr? Why are the two separated? For instance, d0exp
contains function application primitive, whereas instr does not. I made
some wiki edits ( code generation · githwxi/ATS-Postiats Wiki · GitHub), but then
got confused.
And another question: I’d like to separate arguments from local variables
(for IL has different instructions for handling those); currently the code
will check the symbol string (if it starts with “arg”, then it’s an
argument). Guess this would be solved with instr2 (or d0exp2). Function
calls need to be annotated with types of the functions being called, too.
Again, this is work for another pass.
I’d like people who are knowledgeable about JVM to chime in. Perhaps IL
instruction set isn’t much different from that of JVM? Some code could be
shared between two backends, then.
On Monday, August 18, 2014 11:49:16 AM UTC-4, Artyom Shalkhakov wrote:
I’m trying to emit CIL from ATS2. Conditionals need to be translated
into conditional jumps.
Not every instruction in instrlst is labeled with ATSINSflab/ATSINSlab,
so it seems that a pass is needed to insert missing labels or some such.
I added a function tmpvar_is_arg to atsparemit_syntax.sats.On Tuesday, August 19, 2014 10:53:04 AM UTC-4, gmhwxi wrote:
And another question: I’d like to separate arguments from local variables
(for IL has different instructions for handling those); currently the code
will check the symbol string (if it starts with “arg”, then it’s an
argument).
Forgot to answer this one.
Yes, checking if the name begins with ‘arg’ is the right way to do it.
staload STRING = “libc/SATS/string.sats”
fun symbol_is_arg (x: symbol): bool =
$STRING.strncmp (symbol_get_name(x), “arg”, i2sz(3))
On Tuesday, August 19, 2014 12:11:52 AM UTC-4, Artyom Shalkhakov wrote:
On Monday, August 18, 2014 10:22:56 PM UTC+6, gmhwxi wrote:
Yes, another pass.
You can introduce another type instr2 for instructions and then translate
instr to instr2.
OK. One more question: what’s the difference between d0exp (dynamic
expressions?) and instr? Why are the two separated? For instance, d0exp
contains function application primitive, whereas instr does not. I made
some wiki edits ( code generation · githwxi/ATS-Postiats Wiki · GitHub), but then
got confused.
And another question: I’d like to separate arguments from local variables
(for IL has different instructions for handling those); currently the code
will check the symbol string (if it starts with “arg”, then it’s an
argument). Guess this would be solved with instr2 (or d0exp2). Function
calls need to be annotated with types of the functions being called, too.
Again, this is work for another pass.
I’d like people who are knowledgeable about JVM to chime in. Perhaps IL
instruction set isn’t much different from that of JVM? Some code could be
shared between two backends, then.
On Monday, August 18, 2014 11:49:16 AM UTC-4, Artyom Shalkhakov wrote:
I’m trying to emit CIL from ATS2. Conditionals need to be translated
into conditional jumps.
Not every instruction in instrlst is labeled with ATSINSflab/ATSINSlab,
so it seems that a pass is needed to insert missing labels or some such.
You can introduce another type instr2 for instructions and then translate
instr to instr2.
OK. One more question: what’s the difference between d0exp (dynamic
expressions?) and instr? Why are the two separated? For instance, d0exp
contains function application primitive, whereas instr does not. I made
some wiki edits
(code generation · githwxi/ATS-Postiats Wiki · GitHub), but then
got confused.
And another question: I’d like to separate arguments from local variables
(for IL has different instructions for handling those); currently the code
will check the symbol string (if it starts with “arg”, then it’s an
argument). Guess this would be solved with instr2 (or d0exp2). Function
calls need to be annotated with types of the functions being called, too.
Again, this is work for another pass.
I’d like people who are knowledgeable about JVM to chime in. Perhaps IL
instruction set isn’t much different from that of JVM? Some code could be
shared between two backends, then.
You can introduce another type instr2 for instructions and then translate
instr to instr2.On Monday, August 18, 2014 11:49:16 AM UTC-4, Artyom Shalkhakov wrote:
I’m trying to emit CIL from ATS2. Conditionals need to be translated into
conditional jumps.
Not every instruction in instrlst is labeled with ATSINSflab/ATSINSlab, so
it seems that a pass is needed to insert missing labels or some such.
that is the kind of thing that I think would be interesting for ATS
people to talk about. I see the way Haxe has gone and frankly when I
use it, I see that it is a big fat lie in so many ways e.g. the Java
back end is (historically maybe less so now) drastically and rather
dishonestly incomplete.
What I wanted and want is a style of co-programming with ATS and Python.
When programming in a language like Python, one does not really do program
design explicitly; one just writes code and then tests. A great advantage
of ATS
lies in its strong support for specification. For instance, the above link
contains a
so-called specification-like implementation of mergesort in ATS; it is not a running
implementation; it is just some sort of a skeleton. However, I can
typecheck the skeleton
in ATS to gain confidence in its correctness.
With a code generator from ATS to Python, I can now combine the skeleton
with the rest of code
written in Python directly (instead of having to translate the skeleton to
Python manually).
In this way, I can even advocated refinement-based programming to Python
programmers
(who are willing to use ATS to do top-level specification-like
implementation). To me, this is
a promising way to get (formal) specification into mainstream programming.
i’d hope that ATS could (some day) take a minute to gather stock and
seems like there are now multiple people trying to target ATS at other
back-ends. it would be great if your efforts were somehow aligned and
documented so that this could be sort of a standard way for ATS to
grow.
[cf. things such as http://www.shenlanguage.org or even http://www.haxe.org which are languages with multiple back-ends,
sometimes where it is formalized (shen) and less so for others
(haxe).]
Originally, I planned to target Javascript, but I am targeting Python
instead. I think Python is a bit harder to handle because it does not
support directly switch statements. All of my code is on-line:
I still plan to target Javascript later. I learned that Will Blair
would like to target Javascript as well.
Alignment and documentation will come later if they do come. It is in
general very difficult to get a good software product during the first try.
Iterations are often needed.On Monday, August 18, 2014 1:59:43 PM UTC-4, Raoul Duke wrote:
seems like there are now multiple people trying to target ATS at other
back-ends. it would be great if your efforts were somehow aligned and
documented so that this could be sort of a standard way for ATS to
grow.
[cf. things such as http://www.shenlanguage.org or even http://www.haxe.org which are languages with multiple back-ends,
sometimes where it is formalized (shen) and less so for others
(haxe).]
d0exp for dynamic expressions and instr for instructions (statements).On Tue, Aug 19, 2014 at 12:11 AM, Artyom Shalkhakov < artyom.s...@gmail.com> wrote:
On Monday, August 18, 2014 10:22:56 PM UTC+6, gmhwxi wrote:
Yes, another pass.
You can introduce another type instr2 for instructions and then translate
instr to instr2.
OK. One more question: what’s the difference between d0exp (dynamic
expressions?) and instr? Why are the two separated? For instance, d0exp
contains function application primitive, whereas instr does not. I made
some wiki edits ( code generation · githwxi/ATS-Postiats Wiki · GitHub), but then
got confused.
And another question: I’d like to separate arguments from local variables
(for IL has different instructions for handling those); currently the code
will check the symbol string (if it starts with “arg”, then it’s an
argument). Guess this would be solved with instr2 (or d0exp2). Function
calls need to be annotated with types of the functions being called, too.
Again, this is work for another pass.
I’d like people who are knowledgeable about JVM to chime in. Perhaps IL
instruction set isn’t much different from that of JVM? Some code could be
shared between two backends, then.
On Monday, August 18, 2014 11:49:16 AM UTC-4, Artyom Shalkhakov wrote:
I’m trying to emit CIL from ATS2. Conditionals need to be translated
into conditional jumps.
Not every instruction in instrlst is labeled with ATSINSflab/ATSINSlab,
so it seems that a pass is needed to insert missing labels or some such.
Alignment and documentation will come later if they do come. It is in
general very difficult to get a good software product during the first try.
Iterations are often needed.
of course, hear hear. too much early ‘standardization’ slows down the
experimenting too much.
still, having looked and and used some other languages that have
multiple back-ends $0.02:
so one of the ways in which Shen does a better job than I think Haxe
is that Shen tries to have a quite small kernel language. then the
full language sits on top of it, and target languages sit underneath.
it has benefits and drawbacks, of course.
that is the kind of thing that I think would be interesting for ATS
people to talk about. I see the way Haxe has gone and frankly when I
use it, I see that it is a big fat lie in so many ways e.g. the Java
back end is (historically maybe less so now) drastically and rather
dishonestly incomplete.
i’d hope that ATS could (some day) take a minute to gather stock and
see if there could be some unifying strategies here.