--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/ad0158e6-35c0-4a98-9aff-13d9a27578a6%40googlegroups.com.
I gave it a try last night. I encountered many cases of excessive indentation.The syntax of ATS is rich and complex. So it makes sense to require the programmerto manually add indentation. With the current ats-mode, you get two spaces if you hit thetab key. So you are pretty much in control of indentation. As far as I know, a lot of programmerswant this kind of control :)
On Wed, Oct 11, 2017 at 3:43 PM, Andrew Knapp <andy.j...@gmail.com> wrote:
Hello all,By cannibalizing sml.el, I have largely gotten automatic indentation working in ATS.After a few months of sporadic use, the only problem I couldn't fix is excessive indentation after a function has ended.This can be fixed by terminating all functions with semicolons, which is ugly, but it seems to work.If you don't do this, you have to type "fun" and then hit tab to indent properly.Perhaps someone with more experience with programming languages can fix this, since I have no background with parsers.(The code is based on Emacs' SMIE, which uses operator precedence grammars.)Here is the temporary link. Let me know what I need to do to get this upstream.Best,Andrew Knapp
--
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.
sortdef even = { i:int | i mod 2 == 0 }
sortdef agz = {l:addr | l > null}
implement main0 () =
let
...
in
...
end
let
val foo = 3
let
val foo = 3
val bar = 4
let
val foo = 3
+baz()
#include "share/atspre_staload.hats"#include "share/atspre_define.hats"
extern fun imul2 {i,j:int}(i:int i,j:int j):<> [ij:int] (MUL(i,j,ij)|int ij) = "mac#imul2" extern fun atoi(!strptr): int = "mac#atoi" fun test(a:int): int = a+1 typedef qwerty = inttypedef dvorak = double dataprop FACTORIAL(n:int,r:int) = | FACTORIAL_BAS(0,1) of () | {n:nat}{r,r1:int} FACTORIAL_IND(n,r) of (FACTORIAL(n-1,r1), MUL(n,r1,r))
fun factorial {n:nat} .<>. (n:int(n)):<> [r:int] (FACTORIAL(n,r) | int(r)) =let fun loop {i:nat|i <= n} {r:int} .<n-i>. ( pf: FACTORIAL(i,r) | n:int n, i: int i, r: int r ):<> [r:int] (FACTORIAL(n,r) | int r) = if n-i>0 then let val (pfmul | r1) = imul2(i+1,r) in loop(FACTORIAL_IND(pf,pfmul) | n, i+1, r1) end else (pf | r)in loop(FACTORIAL_BAS() | n, 0, 1)end
fun foo(): int =let fun bar(): int = let fun baz(): int = let val x = 3 val y = 4 in if x > 3 then x else y end in baz() endin bar()end
implement main0() = let val x = 3 val (pf | res) = factorial(5)in print_list($list{int}(1,2,3,4,5)); println!(5); println!(res);end
dataprop food = | MILK of () | EGGS of ()
sortdef x = {i:int | i >= 0}sortdef y = {i:int | i mod 2 == 0} fun bar(a:int):int =let val x = 3 val y = 4 val z = 7in x*y+zend
fun foo(): int =let val x = 3 val y = 4 fun loop(a:int):int = let val y = 4 val z = 7 in x+3 endin if x > 3 then 5 else 8end
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-users+unsubscribe@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/3aa42d9a-a59e-411a-ae7d-a7b7505fd13b%40googlegroups.com.
let {
val x = ....;
val y = ....;
}
in {
...
}
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/3aa42d9a-a59e-411a-ae7d-a7b7505fd13b%40googlegroups.com.