Qiitan は、Qiita
™️ の SNS である「Qiitadonβ」のマスコット・キャラクターです。
- キーたん(Qiitan) @ Qiitadon
Qiitan-go
は Qiitan のファン・アプリであり、Qiita™️ とは一切関係がありません。
Qiitan-goalpha
キーたん語(Qiitan-go)は、Qiitan ファンの、Qiitan ファンによる、Qiitan ファンのための「お遊び用スクリプト言語」です。
qiitan
スクリプトの Hello World
スクリプトと実行例
- スクリプト例(
./helloworld.qiitan
)foo := import("fmt") foo.println("Hello World!")
- この qiitan スクリプトは、標準モジュール(
qiitan
インタプリタに同梱されているライブラリ)からfmt
モジュールをfoo
に代入し、そのfmt
モジュール内で定義されているprintln
関数(改行付きprint
関数)を呼び出して標準出力に出力しています。
- この qiitan スクリプトは、標準モジュール(
- 実行例
$ qiitan ./helloworld.qiitan Hello World!
REPL)での実行例
対話モード($ # 対話モード(REPL)で実行
$ qiitan
Welcome to Qiitan Script Interactive Mode! (To exit just type `bye`)
> foo := import("fmt")
LOG: {__module_name__: "fmt", print: <user-function>, printf: <user-function>, println: <user-function>, sprintf: <user-function>}
> foo.println("Hello World!")
Hello World!
LOG: <undefined> object returned. Perhaps the statement has no return or nothing is assigned to it.
>
> bye
Nice chatting with you. Thank you! Bye-bye~.
$
上記の簡易説明
対話モードでは、出力した内容および代入した内容が適宜表示されます。
例えば、foo := import("fmt")
で foo
変数に fmt
モジュールを代入した場合、続く LOG:
の内容から、foo
変数には fmt
モジュールの中身である print()
, printf()
, println()
, sprintf()
の関数が定義されていることが確認できます。
> foo := import("fmt")
LOG: {__module_name__: "fmt", print: <user-function>, printf: <user-function>, println: <user-function>, sprintf: <user-function>}
次に foo.println("Hello World!")
で出力していますが、続く LOG: <undefined> object returned
は、fmt.println()
に戻り値がなかった(型がない値が返ってきた)ことを表しています。
> foo.println("Hello World!")
Hello World!
LOG: <undefined> object returned. Perhaps the statement has no return or nothing is assigned to it.
これは、qiitan
スクリプトでは return
のない関数は <undefined>
オブジェクト(型がないことを示すオブジェクト)が自動的に返されるためです。
プリ・コンパイルと実行
キーたん語は、なんちゃってプリ・コンパイル型の言語です。
qiitan
スクリプトの実行だけでなく、その中間ファイル(バイトコード)を出力することができます。 この中間ファイルも qiitan
インタプリタで実行することができ、プリ・コンパイルが不要なぶんだけ速く実行されます。
$ qiitan -compile ./helloworld.qiitan
compiled: ./helloworld.qtn
$ qiitan ./helloworld.qtn
Hello World!
Install
-
Homebrew (macOS: x86_64/Intel/AMD64, M1/ARM64, Linux & Windows WSL2: x86_64, ARM64, ARM v6)
brew install qithub-bot/apps/qiitan
-
単体バイナリ(Windows, macOS, Linux)
- Releases ページから該当 OS + アーキテクチャをダウンロード。
Statuses
このリポジトリでは、以下のような最低限のセキュリティ対策が施されています。
言語開発(コントリビュート)
qiitan
コマンド(インタプリタ)自体は Go 言語で開発されています。qiitan
コマンド(インタプリタ)は、スタンドアロン(単体)のバイナリとして動作するように設計されています。- CONTRIBUTING
License
- MIT License. Copyright (c) The Qiitan-go Contributors.