ATS may need a keywords-indexed reference

269 views
Skip to first unread message

He-chien Tsai

unread,
Nov 8, 2015, 4:32:49 AM11/8/15
to ats-lang-users

I read all docs hardly and think "Effective ATS Programming through Examples" is potentially the most effective way to learn ATS, but It's still hard to find the meaning of uncommon symbols or keywords in current documents when examples skip some explainations. After a while, I found that a quick overview like Wikipedia's ATS helps me rookies a lot. There's many people says ATS is too hard to learn, I think it's because current doc don't provides an organzed overview and reference. Please consider this documenting approach for offical doc. 

Brandon Barker

unread,
Nov 8, 2015, 9:38:08 AM11/8/15
to ats-lang-users
This is by no means complete, but it is the most comprehensive I now
of: https://github.com/githwxi/ATS-Postiats/wiki/keywords
> --
> 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 http://groups.google.com/group/ats-lang-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ats-lang-users/48b61642-6797-48ba-a947-4751c5aebcfd%40googlegroups.com.



--
Brandon Barker
brandon...@gmail.com

Brandon Barker

unread,
Nov 8, 2015, 9:38:40 AM11/8/15
to ats-lang-users

gmhwxi

unread,
Nov 8, 2015, 5:09:47 PM11/8/15
to ats-lang-users

Yannick Duchêne

unread,
Dec 10, 2015, 5:36:20 PM12/10/15
to ats-lang-users
Hello,

For predefined sorts and others, you may also look in the source:

Line 242 to line 283

And:
Line 96 to line 147/

There are some at other places…

Yannick Duchêne

unread,
Dec 10, 2015, 7:46:24 PM12/10/15
to ats-lang-users


Le jeudi 10 décembre 2015 23:36:20 UTC+1, Yannick Duchêne a écrit :
Hello,

For predefined sorts and others, you may also look in the source:

Line 242 to line 283

And:
Line 96 to line 147/

There are some at other places…
 

Additionally, and as I needed it anyway for some personal use, here are lists of lexical units, keywords and other stuffs, taken from two sources. There are duplicates.

From pats_lexing.dats
==============================================================================

Comment starts:
   
/*
    //
    ////

Keywords:
    abst
    abst@ype
    absviewt
    absviewt@ype
    absvt
    absvt@ype
    addr
    addr@
    case
    case+
    case-
    fix
    fix@
    fold
    fold@
    for
    for*
    free
    free@
    lam
    lam@
    llam
    llam@
    prop
    prop+
    prop-
    ref
    ref@
    t
    t0ype (= t@ype)
    t0ype+
    t0ype-
    t@ype
    t@ype (= t0ype)
    type
    type+
    type-
    val
    val+
    val-
    view
    view+
    view-
    view@
    viewt
    viewt0ype (= viewt@ype)
    viewt0ype+
    viewt0ype-
    viewt@ype
    viewt@ype (= viewt0ype)
    viewtype
    viewtype+
    viewtype-
    vt
    vt0ype (= vt@ype)
    vt0ype+
    vt0ype-
    vt@ype
    vt@ype (= vt0ype)
    vtype
    vtype+
    vtype-
    while
    while*


From pats_lexing.sats
==============================================================================

Keywords:
    absview
    absviewt@ype
    absviewtype
    addr@
    and
    as
    assume
    begin
    case
    case+
    case-
    classdec
    dataprop
    datasort
    datatype
    dataview
    dataviewtype
    do
    dynload
    else
    end
    exception
    extern
    fix
    fix@
    fn
    fnx
    fold@
    for
    for*
    free@
    fun
    if
    implement
    implmnt
    import
    in
    infix
    infixl
    infixr
    lam
    lam@
    let
    llam
    local
    macdef
    macrodef
    nonfix
    of
    op
    overload
    postfix
    prcase
    prefix
    prfn
    prfun
    primplmnt
    propdef
    prval
    prvar
    rec
    ref@
    scase
    sif for static if
    sortdef
    stacst
    stadef
    staload
    static
    symelim
    symintr
    then
    tkindef
    try
    type
    type+
    type-
    typedef
    val
    val+
    val-
    var
    view@
    viewdef
    viewtypedef
    when
    where
    while
    while*
    with

Keywords from DML, now rarely used:
    withtype
    withprop
    withview
    withviewtype

Suspended keywords:
    stavar

Function effects tags (not real keywords):
    ntm
    exn
    ref
    wrt
    all

Preprocessor-like (not keywords and invalid as identifiers):
    #assert
    #codegen2
    #codegen3
    #define
    #elif
    #elifdef
    #elifndef
    #else
    #endif
    #error
    #if
    #ifdef
    #ifndef
    #include
    #print
    #require
    #then
    #undef

Special functions/values
(not keywords and invalid as identifiers):
    $
    $arrpsz
    $arrptrsize
    $break
    $continue
    $d2ctype
    $delay
    $effmask
    $extern
    $extkind
    $ldelay
    $literal
    $lst
    $lst_t
    $lst_vt
    $myfilename
    $myfunction
    $mylocation
    $raise
    $rec
    $rec_t
    $rec_vt
    $showtype
    $solver_assert
    $solver_verify
    $tempenver
    $tup
    $tup_t
    $tup_vt
    $vcopyenv_v
    $vcopyenv_vt

Punctuation-like:
    {
    |
    }
    ~
    !
    #
    #[
    %(
    '(
    '[
    '{
    (
    )
    ,
    ,(
    -<
    -<>
    ->
    .
    ..
    ...
    .<
    .<>.
    :
    :<
    ;
    <
    <>
    =
    =/=>
    =/=>>
    =<
    =<>
    =>
    =>>
    >
    >.
    @
    @(
    @[
    @{
    [
    \
    ]
    `
    `(


Special (a dot followed by a decimal integer):
    .[0-9]+

Others (lexical):
    alnum
    symbol
    A[...]
    A<...>
    $alnum
    #alnum
    character
    float
    cdata
    string
    line comment
    block comment
    rest-of-file comment
    errors
    end-of-file




Yannick Duchêne

unread,
Dec 10, 2015, 7:55:58 PM12/10/15
to ats-lang-users


Le vendredi 11 décembre 2015 01:46:24 UTC+1, Yannick Duchêne a écrit :

Additionally, and as I needed it anyway for some personal use, here are lists of lexical units, keywords and other stuffs, taken from two sources. There are duplicates.


And for a fix about these lists: the “(*” comment start if missing (the lexer starts to read a single parenthesis, tha's why), “abst”, “absvt”, “t” and “vt”, are not keywords (the lexer uses these prefix, that's why they were there). Also, I feel some @ vs 0 synonymous are missing.

Yannick Duchêne

unread,
Jul 2, 2018, 5:27:43 PM7/2/18
to ats-lang-users
In https://github.com/Hibou57/PostiATS-Utilities/tree/master/doc , I just added a document named `lexemes.md` which documents the lexical rules for Postiats. I will review it again later, I feel I need to fix something while I believe it’s mostly OK.

This is not a reference index of the keywords, this is yet to come …

I hope to write a reference document for the grammar too, but I’m afraid it will take long (there exist one for ATS1, but it’s not the same for ATS2, ex. `prvar` did not exist in ATS1 and I prefer to be sure it will really be the one for ATS2).

Will also entirely rewrite the GtkSourceview highlighter for ATS2, as now I know it is wrong in many ways.

Yannick Duchêne

unread,
Jul 5, 2018, 10:14:09 AM7/5/18
to ats-lang-users


Le lundi 2 juillet 2018 23:27:43 UTC+2, Yannick Duchêne a écrit :
[…]
This is not a reference index of the keywords, this is yet to come …
[…]

For now, here is at least a keywords list  reference (I hope): https://github.com/Hibou57/PostiATS-Utilities/blob/master/doc/keywords.md

It gives a list of keywords with reference to lexical productions, an expanded informational version of this list and an informational list of keywords synonymous groups.

Working on this, I discovered keywords I would not have suspected, such as “absvtflat”, which is the same as “absvt@ype”. I checked the compiler indeed accepts it.

A keyword based reference it yet to come (can’t tell when).

Yannick Duchêne

unread,
Jul 8, 2018, 4:52:24 AM7/8/18
to ats-lang-users
A document named `symbols.md` was just added. It’s about some special identifiers which are not distinguished as lexical unit.

By the way, some file names will change in the near future, so it’s better to avoid directly linking to a file (I made the error myself), better to the doc directory, before the whole is stable enough (can’t tell when). There will be guide documents to translate some things in a wording better suited to practitioners (ex. without reference to Postiats sources). One of this guide document will be the keyword indexed help to ATS2.

Yannick Duchêne

unread,
Jul 11, 2018, 6:00:48 AM7/11/18
to ats-lang-users
Just added (*) `lexemes-guide.md`. It is not shorter than `lexemes-ref.md` and is even more verbose, but more readable and less intimidating. This is an overview of the difference there will be between *-ref and *-guide documents, which will have different audience and intents. In particular *-ref documents will make references to Postiats source and *-guide documents won’t, on purpose.

I’m very slow, but it goes on.


aditya siram

unread,
Jul 11, 2018, 7:56:51 AM7/11/18
to ats-lang-users
This is great, a very useful reference. Is there any reason to keep the redundant keywords (implement vs. implmnt)? Seems like getting rid of them in ATS 3 would make it simpler.

Yannick Duchêne

unread,
Jul 11, 2018, 11:55:24 AM7/11/18
to ats-lang-users


Le mercredi 11 juillet 2018 13:56:51 UTC+2, aditya siram a écrit :
This is great, a very useful reference. Is there any reason to keep the redundant keywords (implement vs. implmnt)? Seems like getting rid of them in ATS 3 would make it simpler.

Hello,

Professor Xi may tell more, but for now I’m not sure it’s strictly the same: "implement" and "implmnt" are turned intro a type constructor getting an integer argument: `T_IMPLEMENT (knd)` where `knd` is 1 for "implement" and zero for "implmnt" (for completeness, -1 for "primplmnt"). I will inevitably get into this question a future day.

That said, there are indeed many synonymous in ATS2, but as far as I know, it’s more with predefined and/or special identifiers than with keywords. This may be confusing if one don’t know exactly, but it will be a lot less with a documentation covering all of this.

Yes, it may be good to avoid it, but on the other hand, it allows one to choose the most expressive one. Or else, a single choice for all will have to be made, with the hope it will please every one.

gmhwxi

unread,
Jul 11, 2018, 12:53:57 PM7/11/18
to ats-lang-users

The orignal plan was to use implmnt for non-recursive
implementations and 'implement' for recursive ones. There
are probably better ways to do this. Will revisit such issues
later.

Yannick Duchêne

unread,
Jul 11, 2018, 6:01:09 PM7/11/18
to ats-lang-users
What about a slight overloading the `rec` keyword?

gmhwxi

unread,
Jul 11, 2018, 11:26:12 PM7/11/18
to ats-lang-users
Yes, that is a posibility. For instance:

@rec
implement

@tailrec
implement

@nonrec
implement

@proof
implement

Yannick Duchêne

unread,
Jul 23, 2018, 10:35:34 PM7/23/18
to ats-lang-users
In https://github.com/Hibou57/PostiATS-Utilities/tree/master/doc , I just added `syntax-guide.md`. It’s not yet finished but I’m telling now since I believe this will be a bit long. For the syntax, I’m using a simple but relevant enough set of rules for segmenting ATS2 source. The segments can nest. I checked with a dedicated parser it’s relevant. Later (probably in a rather far future), there will be inner syntax rules for what I call “segment parts” in the document. For now, I started to document the big lines construct and that’s what I will finish first before anything else.

For the anecdote, for parsing, I needed only two hacks: one for function effect expressions and one for `where` expression which is split in two sub‑hacks. The function effects hack is actually an hack in the lexer (which is in the repository). The `where` expression hack was needed because it was the only construct not matching well the simple model I used. The issue with it, was that it may contains expressions or list of declarations while its end marker is optional and it also can be written using braces paires. The parser is not in the repository, only the lexer.

Vanessa McHale

unread,
Jul 23, 2018, 10:41:03 PM7/23/18
to ats-lan...@googlegroups.com

Neat! I've resigned to the fact that the language-ats library will have some bugs (and I'm hoping to avoid the scenario with XATS), but this will definitely help out with the vim plugin and test cases :)


On 07/23/2018 09:35 PM, 'Yannick Duchêne' via ats-lang-users wrote:
In https://github.com/Hibou57/PostiATS-Utilities/tree/master/doc , I just added `syntax-guide.md`. It’s not yet finished but I’m telling now since I believe this will be a bit long. For the syntax, I’m using a simple but relevant enough set of rules for segmenting ATS2 source. The segments can nest. I checked with a dedicated parser it’s relevant. Later (probably in a rather far future), there will be inner syntax rules for what I call “segment parts” in the document. For now, I started to document the big lines construct and that’s what I will finish first before anything else.

For the anecdote, for parsing, I needed only two hacks: one for function effect expressions and one for `where` expression which is split in two sub‑hacks. The function effects hack is actually an hack in the lexer (which is in the repository). The `where` expression hack was needed because it was the only construct not matching well the simple model I used. The issue with it, was that it may contains expressions or list of declarations while its end marker is optional and it also can be written using braces paires. The parser is not in the repository, only the lexer.
--
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.
signature.asc

Yannick Duchêne

unread,
Jul 24, 2018, 6:38:59 AM7/24/18
to ats-lang-users


Le mardi 24 juillet 2018 04:41:03 UTC+2, Vanessa McHale a écrit :

Neat! I've resigned to the fact that the language-ats library will have some bugs (and I'm hoping to avoid the scenario with XATS), but this will definitely help out with the vim plugin and test cases :)


I feel to guess you are talking about the lexer. If it is, then it may be useful I add a sample program to show how to use it. There are three things one need to know about it. It returns a position in characters, for simplicity and because it is still possible to convert to line/column with a list of line positions. It needs to read input byte by byte like Postiats do, that’s why there is a `file_input` method which opens a file as ISO-8859-15 and return an `Input` object. The third point is about the hack: when the lexer just passed a :< or =< or -< it enters in a mode where it does not translates identifiers into keyword, except with the next closing > which make it leave this mode.
Reply all
Reply to author
Forward
0 new messages