Skip to content

Instantly share code, notes, and snippets.

@master-q
Last active October 12, 2018 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save master-q/af979857a50bd056b2df72b1eeb44ea8 to your computer and use it in GitHub Desktop.
Save master-q/af979857a50bd056b2df72b1eeb44ea8 to your computer and use it in GitHub Desktop.
Latest news on ATS language - October 2018
= ATS最新動向 2018-10-10
[2018-10-10 15:08]
<<<ATS
<<<最新動向
<<<サーベイ
=== 最新のまとめ
http://b.hatena.ne.jp/masterq/ats
=== ATS3
* https://groups.google.com/d/topic/ats-lang-users/mjS9NtQz6Pg
* https://github.com/githwxi/ATS-Xanadu
```
I decided to pick ATS/Xanadu for the full project name. I like the name Xanadu
because it is poetic and brings a feel of exoticness.
ATS3 is supposed to be compiled to ATS2. At least at the beginning. I will try to
write more about what I have in mind regarding ATS3.
I know that a lot of people have been complaining about the syntax of ATS2. So
we can start the effort of designing some "nice" syntax for ATS3. Please feel free
to post here if you would like share your opinions and ideas.
I will be happy to take the lead but we definitely need to have some form of community
effort on this project given its size and scope.
```
意見:
* abst@ype読みにくいね!
* ReasonMLっぽいのがいいね!
* 多次元配列を扱いやすくしてほしい!
* Haskellスタイルのletとwhere
* リテラルがどのように解釈されるのか決定できること
* Haskellテンプレートのようなメタプログラミング
* Module
* セッション型
* コンパイラを一体ではなくモジュール化する / parsing, type equality, constraints solving, template dispatch, type erasure, etc.
* (hash, binary IR)ペアをファイルベースのデータベースに格納する
* Interpreter, REPL, language servers, documentation tools, standard libraries, type inference, etc.
* Hindley-Milner type inference
* 線形型関数を書きやすいシンタックスシュガー
* clo1のようなサフィックスは不要にできないか
* ["this", "is", "a", "list"] のようなリストリテラル
* $FOO がシェル変数のように見える
* C言語コードをcatsに追い出したい
* もしくは %C{ ... %} のようにインラインの言語を指定したい
* 複数行の文字列
* lightweight concurrency。でもこれを言語処理系として取り込むとATSではなくなるのでは
* わかりやすいコンパイルエラー
* IDEのサポート
* 構文が複雑すぎる。シンプルだとlanguage-atsも作りやすい。もしくは簡潔さ
* フラットな型のよりよいサポート(flat unions, flat unboxed arrays on stack, etc.)
* wasmへのコンパイル
* パッケージマネージャやビルドツール
* intricately-linkedなデータ構造のサポート(doubly-linked lists, doubly-linked trees, etc.)
* クロスコンパイル
* まわりくどい文法をやめる。Scalaっぽいのが好み
* 簡潔さ
* スケールしながら学ぶための隠された大量の機能
* Rewrite and linting tool such like https://github.com/scalacenter/scalafix
まだ意見が出てなかったので、以下だけ追加で意見しておいた:
* DWARFに対応してGDBが使えること
=== でんちゅーがらす
* "ATSで組み込みドライバを実装してみる③" http://namakin.hatenablog.com/entry/2018/08/26/092439
* https://twitter.com/higenasu
すばらしいまとめ:
```
「証明は辛いけど面白いけど辛い」
「線形型はいいぞ」
「RenesasはOR/AND用のレジスタを作れ」
「自動証明早よ」
```
=== Vanessa‍McHale
http://vmchale.com/static/resume.pdf
* Haskell/VHDL/GPU/{フランス,ドイツ}語/IOHK勤務
2018年に突如ATS界に降臨したスーパーガール。
==== http://blog.vmchale.com/
はてなブックマークに一言ずつコメントを書いた。
総括として彼女のバランス感覚は
https://github.com/vmchale/polyglot
を詳しく見た方が良さそう。
==== https://github.com/vmchale/polyglot
おそらくVanessa‍による初の実用的アプリケーション。
Rustの20倍速い。本当か。
言語のサポート範囲が小さい気がする。というかlocさんの解釈めちゃくちゃでは。。。
```
$ cat ~/tmp/run.sh
#!/bin/sh
sync; sync; sync
poly --version
loc --version
cat .git/config
time poly
time loc .
$ bash ~/tmp/run.sh
polygot version 0.5.14
Copyright (c) 2018 Vanessa McHale
loc 0.5.0
tokei 8.0.1 compiled without serialization formats.
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://github.com/NetBSD/src.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "trunk"]
remote = origin
merge = refs/heads/trunk
-------------------------------------------------------------------------------
Language Files Lines Code Comments Blanks
-------------------------------------------------------------------------------
Ada 1 30 24 0 6
Alex 26 5089 4534 0 555
Assembly 2211 802854 732174 622 70058
Awk 64 7256 5210 1477 569
Autoconf 104 5198 3006 1308 884
Automake 1 25 20 0 5
Brainfuck 1 56 56 0 0
C 13335 5924032 5189005 805 734222
C++ 65 12100 10395 172 1533
C Header 15112 4212305 3521475 0 690830
D 44 863 805 0 58
Dash 286 24490 17345 4102 3043
Eiffel 1 1189 1189 0 0
Emacs Lisp 2 131 121 1 9
Haskell 7 553 494 0 59
HTML 9 3951 3786 0 165
Lex 24 7768 6889 0 879
Lua 10 612 422 112 78
M4 5 557 482 0 75
Makefile 7112 157199 114359 11582 31258
Markdown 11 2583 2166 0 417
Objective C 1 136 113 0 23
Perl 66 5516 4735 0 781
Plaintext 23 10361 9447 0 914
R 38 358 333 0 25
Scheme 6 1686 1288 244 154
Sed 8 472 304 156 12
SQL 3 256 150 89 17
Yacc 27 17529 15380 0 2149
-------------------------------------------------------------------------------
Total 38603 11205155 9645707 20670 1538778
-------------------------------------------------------------------------------
real 0m0.791s
user 0m1.342s
sys 0m0.590s
--------------------------------------------------------------------------------
Language Files Lines Blank Comment Code
--------------------------------------------------------------------------------
C 43107 26570664 3244151 4351860 18974653
C/C++ Header 35062 9777144 1386523 2255293 6135328
C++ 19751 4548431 548749 819836 3179846
Assembly 9931 3020509 423056 345508 2251945
Plain Text 2024 1090662 193328 0 897334
Makefile 10575 1064915 138062 74881 851972
Markdown 813 840261 91393 0 748868
Bourne Shell 3228 690014 79156 117608 493250
DeviceTree 2370 596116 72717 45628 477771
HTML 932 402175 58837 3281 340057
Perl 820 409707 44943 40003 324761
Autoconf 2436 415961 61455 70755 283751
XML 594 169865 16393 3502 149970
Yacc 202 153436 18788 13543 121105
reStructuredText 323 158926 40168 0 118758
TeX 43 180684 15126 54881 110677
Python 573 97443 16507 20575 60361
Objective-C 1557 148530 17352 73395 57783
Scala 190 34244 3639 3263 27342
CMake 518 24731 2789 3032 18910
Objective-C++ 405 45912 4717 25424 15771
Protobuf 19 20241 4393 370 15478
D 434 34464 3024 16100 15340
Ada 670 30986 5090 11652 14244
ASP.NET 27 14229 305 0 13924
Awk 145 18403 1678 3691 13034
YAML 214 16541 371 3331 12839
AmbientTalk 58 16204 2772 1072 12360
OCaml 96 17313 2553 3871 10889
INI 12 7136 127 0 7009
OpenCL 210 13112 2052 4152 6908
Pascal 33 7735 1206 965 5564
Lisp 69 7830 939 1803 5088
Batch 96 5616 897 129 4590
Go 41 4499 501 611 3387
SQL 49 4372 750 845 2777
C# 59 3719 439 786 2494
FORTRAN Modern 40 4049 609 970 2470
CSS 29 2957 400 212 2345
CUDA 115 6902 1089 3520 2293
Tcl 16 2873 399 381 2093
Hex 1 2047 2 0 2045
Prolog 5 1609 10 0 1599
GLSL 1 1577 0 0 1577
Forth 59 1921 212 177 1532
TypeScript 2 1286 4 0 1282
Wolfram 5 1244 0 0 1244
Ruby 10 1166 187 120 859
JSON 23 878 57 0 821
UnrealScript 1 806 0 0 806
Java 18 1059 61 274 724
Lua 15 1056 121 248 687
LinkerScript 11 705 27 31 647
Rust 11 832 167 127 538
VimL 10 664 78 136 450
SML 2 554 68 56 430
R 41 365 26 0 339
Haskell 7 553 59 209 285
ActionScript 4 234 33 0 201
JavaScript 5 255 32 43 180
Elixir 1 143 0 0 143
C Shell 1 138 26 3 109
FORTRAN Legacy 12 332 46 185 101
Docker 4 172 16 74 82
PHP 2 41 5 6 30
Swift 2 23 6 0 17
--------------------------------------------------------------------------------
Total 138139 50699171 6508686 8378418 35812067
--------------------------------------------------------------------------------
real 0m7.134s
user 0m25.222s
sys 0m2.784s
```
==== https://github.com/vmchale/atspkg
ATSで書かれたvmchale製のツール群。
==== https://github.com/vmchale/atspkg/tree/master/ats-pkg
以下でリリース版パッケージをインストールできる。
```
$ atspkg remote https://github.com/vmchale/polyglot/archive/master.zip
```
このatspkg自体は以下でインストール/最新版に更新できる。
```
$ curl -sSl https://raw.githubusercontent.com/vmchale/atspkg/master/bash/install.sh | sh -s
$ atspkg upgrade
$ atspkg --help
atspkg - a build tool for ATS see 'man atspkg' for more detailed help
Usage: atspkg [-V|--version] COMMAND
The atspkg build tool for ATS-Postiats.
Available options:
-h,--help Show this help text
-V,--version Show version
Available commands:
install Install all binaries to $HOME/.local/bin
clean Clean current project directory
remote Fetch and install a binary package
build Build current package targets
test Test current package
nuke Uninstall all globally installed libraries
upgrade Upgrade to the latest version of atspkg
valgrind Run generated binaries through valgrind
run Run generated binaries
check Check that a pkg.dhall file is well-typed.
check-set Audit a package set to ensure it is well-typed.
list List available packages
setup Install manpages and shell completions.
```
ATSのパッケージプロジェクトは以下のようにpiを使うことでテンプレから作れる。
```
$ curl -LSfs https://japaric.github.io/trust/install.sh | sh -s -- --git vmchale/project-init
$ pi new ats project
$ cd project
$ atspkg run
Resolving dependencies...
# patsopt (for .atspkg/c/src/project.c)
# gcc (for target/project)
# strip (for target/project)
# project (for run)
Hello, World!
```
Dhallによるパッケージの設定手順は以下を参照:
https://github.com/vmchale/atspkg/blob/master/ats-pkg/EXAMPLES.md
感想:
* RustのCargoのようなナウい設計
* piはRust実装 https://github.com/vmchale/project-init
* atspkgはHaskell実装 https://github.com/vmchale/atspkg/tree/master/ats-pkg
* ATSプロジェクトのテンプレは指定できる `pi git vmchale/haskell-ats ambitious-project`
==== https://github.com/vmchale/atspkg/tree/master/ats-format
インストール手順:
```
$ cabal update
$ cabal install ats-format --happy-options='-gcsa' -O2
$ atsfmt --help
ats-format - a source code formatter written in Haskell
Usage: atsfmt [-V|--version] [FILEPATH] [-i] [-o|--no-config] [--default-config]
ATS source code formater. For more detailed help, see 'man atsfmt'
Available options:
-h,--help Show this help text
-V,--version Show version
FILEPATH File path to ATS source.
-i Modify file in-place
-o,--no-config Ignore configuration file
--default-config Generate default configuration file in the current
directory
```
試しにフォーマッタにかけてみる:
```
$ pwd
/home/kiwamu/src/ATS-Xanadu/srcgen/xats/DATS
casper$ wc -l *.dats|sort -n|tail
812 staexp0.dats
1050 dynexp0_print.dats
1223 xatsopt.dats
1227 lexing_token.dats
1317 trans01_staexp.dats
1725 lexing_util0.dats
2180 parsing_staexp.dats
2550 trans01_dynexp.dats
3295 parsing_dynexp.dats
23177 total
$ atsfmt -i parsing_dynexp.dats
Error: unexpected token '//' at 71:1
$ atsfmt -i staexp0.dats
Error: unexpected token '{' at 56:18
```
まだlanguage-ats十分にATS文法をサポートしていないようだ。
そりゃそうか。
=== YouTubeチャンネルができた
https://www.youtube.com/channel/UCYOrtZYEV1hAtvZDcrL277Q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment