ATS3: syntax

82 views
Skip to first unread message

gmhwxi

unread,
Oct 21, 2018, 1:45:19 PM10/21/18
to ats-lang-users

I will be working on documenting the syntax of ATS3 from time to time:


This is also time for me to clarify my own thoughts. Whenever I implemented
ATS in the past, I felt rushed to get things done. This time I am trying to take
time to do a bit of thinking before coding :)

Obviously, some changes to the syntax will be made over the time if needed.
Please bear in mind that ATS3 is meant to be both a source language and a target language.
Its current syntax is on the verbosity side. More syntactic sugar could be added later.

As always, you are welcome to give your comments, suggestions, feedback, etc.
Feel free to ask questions, too.

Cheers!

--Hongwei

Kiwamu Okabe

unread,
Oct 21, 2018, 7:43:43 PM10/21/18
to ats-lan...@googlegroups.com
Why not introduce Proof stuff at `overview.txt `?

I believe ATS3 stands on:

* Dynamics
* Proofs
* Statics

http://cs.likai.org/ats/ml-programmers-guide-to-ats

And also the Proofs are important parts for me.

Kiwamu Okabe

unread,
Oct 21, 2018, 7:48:55 PM10/21/18
to ats-lan...@googlegroups.com
I think we need `ATS-Xanadu/docgen/SYNTAX/README.md` for table of contents.

Kiwamu Okabe

unread,
Oct 21, 2018, 7:52:23 PM10/21/18
to ats-lan...@googlegroups.com
If `ATS-Xanadu/docgen/SYNTAX` is a specification document, not a
tutorial, we do not need to choose any format such like markdown, TeX,
SGML, XML, HTML, etc...
Let's choose your style as plain text such like RFC:

https://www.rfc-editor.org/in-notes/rfc-index.txt

But we need TOC.

gmhwxi

unread,
Oct 21, 2018, 8:04:40 PM10/21/18
to ats-lang-users
 
Proofs are part of dynamics. As far syntax design is concerned, writing a proof
is pretty much like writing a program.


Kiwamu Okabe

unread,
Oct 21, 2018, 8:09:36 PM10/21/18
to ats-lan...@googlegroups.com
On Mon, Oct 22, 2018 at 9:04 AM gmhwxi <gmh...@gmail.com> wrote:
> Proofs are part of dynamics. As far syntax design is concerned, writing a proof
> is pretty much like writing a program.

OK. I should re-draw my big picture:

http://jats-ug.metasepi.org/draw/flow.png
--
Kiwamu Okabe at METASEPI DESIGN

gmhwxi

unread,
Oct 21, 2018, 8:12:03 PM10/21/18
to ats-lang-users

I don't want to take the RFC route. At least not for now. ATS is too rich
and complex to be handle in this way.

I am writing some notes now. In these notes, I plan to mostly talk about
various syntax entities in ATS3 and also use concrete examples to illustrate
them.

Once I have written enough notes, I (or someone else) can quick prepare
a TOC based on these notes.

Kiwamu Okabe

unread,
Oct 21, 2018, 8:17:52 PM10/21/18
to ats-lan...@googlegroups.com
As a translator English to Japanese, I would like to choose `po4a` tool.

https://po4a.org/index.php.en

It can maintain translations on gettext, and be easy to track original update.
Could you choose your document format from followings which are supported
by po4a:

* manpages
* POD
* XML (generic, DocBook, XHTML, Dia, Guide, or WML)
* SGML
* TeX (generic, LaTeX, or Texinfo)
* text (simple text files with some formatting, markdown, or AsciiDoc)
* INI
* KernelHelp

Regards,

Hongwei Xi

unread,
Oct 21, 2018, 8:21:20 PM10/21/18
to ats-lan...@googlegroups.com

>> text (simple text files with some formatting, markdown, or AsciiDoc)

I choose this one: Text + Markdown is what I like most these days :)

--
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.
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/CAEvX6d%3DO2Vu%2BSggZ0UA38DK_gCBQzDtbHjzd9qiVb7wv_a_YvA%40mail.gmail.com.

Vanessa McHale

unread,
Oct 21, 2018, 8:57:01 PM10/21/18
to ats-lan...@googlegroups.com

You can use pandoc to get manpages, TeX, etc. if you'd like :)

signature.asc

Kiwamu Okabe

unread,
Oct 21, 2018, 10:02:05 PM10/21/18
to ats-lan...@googlegroups.com
On Mon, Oct 22, 2018 at 9:21 AM Hongwei Xi <gmh...@gmail.com> wrote:
> I choose this one: Text + Markdown is what I like most these days :)

:+1:

Kiwamu Okabe

unread,
Oct 21, 2018, 10:43:45 PM10/21/18
to ats-lan...@googlegroups.com
I have question: what is different on following?:

* #infix0
* #infixl
* #infixr

How about introduce your infix syntax such like Haskell?

"Infix Functions In Haskell"
https://wuciawe.github.io/functional%20programming/haskell/2016/07/03/infix-functions-in-haskell.html

The infix syntax in Haskell has:

A. order such like `infixl 7 *`
B. way on left or right

I believe that you already have B on your infix syntax, but not A.

Kiwamu Okabe

unread,
Oct 21, 2018, 10:57:10 PM10/21/18
to ats-lan...@googlegroups.com
On Mon, Oct 22, 2018 at 11:43 AM Kiwamu Okabe <kiw...@debian.or.jp> wrote:
> How about introduce your infix syntax such like Haskell?
>
> "Infix Functions In Haskell"
> https://wuciawe.github.io/functional%20programming/haskell/2016/07/03/infix-functions-in-haskell.html
>
> The infix syntax in Haskell has:
>
> A. order such like `infixl 7 *`
> B. way on left or right
>
> I believe that you already have B on your infix syntax, but not A.

Ah, I already has A:

```
#infixl * / % mod of 60
```

When we use `#infix0`? Why use that?

Hongwei Xi

unread,
Oct 21, 2018, 10:59:11 PM10/21/18
to ats-lan...@googlegroups.com
It is all explained here:


#infix0 : infix with no associativity
#infixl : infix with left associativity
#infixr : infix with right associativity

The way I handle fixity is very similar to that of Haskell. But a bit more general.
For instance, I allow an operator to be both infix and prefix (or infix and postfix).
Also, you can do

#infixl ++ of +(-1) //  ++ is infixl and its precedence value is 1 less than that of +

--
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.
Visit this group at https://groups.google.com/group/ats-lang-users.

Kiwamu Okabe

unread,
Oct 21, 2018, 11:00:28 PM10/21/18
to ats-lan...@googlegroups.com
Ah...

```
$ git grep infix0 | cat
docgen/SYNTAX/fixity.txt:#infix0 foo2 bar2
docgen/SYNTAX/fixity.txt:#infix0 baz of 71
prelude/fixity.sats:#infix0 < <= > >= of 40
prelude/fixity.sats:#infix0 = != == !== of 30
prelude/fixity.sats:#infix0 := of 0 // HX: assign
prelude/fixity.sats:#infix0 :=: of 0 // HX: exchange
prelude/fixity.sats:#infix0 :+= :-= :*= :/= // x:=x+a, x:=x-a, ...
prelude/fixity.sats:#infix0 :=+ :=- :=* :=/ // x:=a+x, x:=a-x, ...
srcgen/xats/DATS/lexing_kword.dats:val () = myins("#infix0", T_INFIX_)
srcgen/xats/TEST/DATA/syntax_dyn.dats:#infix0 40 < <= > >=
srcgen/xats/TEST/DATA/syntax_dyn.dats:#infix0 (0) := // HX: assign
srcgen/xats/TEST/DATA/syntax_dyn.dats:#infix0 (0) :=: // HX: exchange
srcgen/xats/TEST/DATA/syntax_dyn.dats:#infix0 (0) :+= :-= :*= :/= //
x:=x+a, x:=x-a, ...
srcgen/xats/TEST/DATA/syntax_dyn.dats:#infix0 (0) :=+ :=- :=* :=/ //
x:=a+x, x:=a-x, ...
srcgen/xats/TEST/DATA/syntax_sta.sats:#infix0 < <= of 40
srcgen/xats/TEST/DATA/syntax_sta.sats:#infix0 > >= of 40
srcgen/xats/TEST/DATA/syntax_sta.sats:#infix0 = == != of 30
```

`#infix0` is only for equation? If so, please note that on `fixity.txt`.

Kiwamu Okabe

unread,
Oct 21, 2018, 11:02:37 PM10/21/18
to ats-lan...@googlegroups.com
On Mon, Oct 22, 2018 at 11:59 AM Hongwei Xi <gmh...@gmail.com> wrote:
> It is all explained here:
>
> https://github.com/githwxi/ATS-Xanadu/blob/master/docgen/SYNTAX/fixity.txt
>
> #infix0 : infix with no associativity
> #infixl : infix with left associativity
> #infixr : infix with right associativity

Thanks. It's clear for me, now.
Reply all
Reply to author
Forward
0 new messages