The interpreter for qiitan script. Yet another dialect of the Tengo language.

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 ./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)


Statuses

このリポジトリでは、以下のような最低限のセキュリティ対策が施されています。

go1.14+ Platform Tests golangci-lint CodeQL codecov Go Report Card


言語開発(コントリビュート)

go1.16+ Go Reference

  • qiitan コマンド(インタプリタ)自体は Go 言語で開発されています。
  • qiitan コマンド(インタプリタ)は、スタンドアロン(単体)のバイナリとして動作するように設計されています。
  • CONTRIBUTING

License

Owner
Qithub - QiitaとQiitadonとGitHubをつなげるBOT
QiitaとQiitadonのユーザ間コラボレーションを支援するためのBOTを共同で作るためのOrganizationです。
Qithub - QiitaとQiitadonとGitHubをつなげるBOT
Similar Resources

A BASIC interpreter written in golang.

A BASIC interpreter written in golang.

05 PRINT "Index" 10 PRINT "GOBASIC!" 20 PRINT "Limitations" Arrays Line Numbers IF Statement DATA / READ Statements Builtin Functions Types 30 PRINT "

Dec 24, 2022

Prolog interpreter in Go

golog Prolog interpreter in Go with aspirations to be ISO compatible. See the full package documentation for usage details. Install with go get github

Nov 12, 2022

A simple virtual machine - compiler & interpreter - written in golang

go.vm Installation Build without Go Modules (Go before 1.11) Build with Go Modules (Go 1.11 or higher) Usage Opcodes Notes The compiler The interprete

Dec 17, 2022

A JavaScript interpreter in Go (golang)

otto -- import "github.com/robertkrimen/otto" Package otto is a JavaScript parser and interpreter written natively in Go. http://godoc.org/github.com/

Jan 2, 2023

A shell parser, formatter, and interpreter with bash support; includes shfmt

sh A shell parser, formatter, and interpreter. Supports POSIX Shell, Bash, and mksh. Requires Go 1.14 or later. Quick start To parse shell scripts, in

Jan 8, 2023

Lisp Interpreter

golisp Lisp Interpreter Usage $ golisp foo.lisp Installation $ go get github.com/mattn/golisp/cmd/golisp Features Call Go functions. Print random in

Dec 15, 2022

Mini lisp interpreter written in Go.

Mini Go Lisp Mini lisp interpreter written in Go. It is implemented with reference to the d-tsuji/SDLisp repository written in Java. Support System Fu

Nov 25, 2022

Toy Lisp 1.5 interpreter

Lisp 1.5 To install: go get robpike.io/lisp. This is an implementation of the language defined, with sublime concision, in the first few pages of the

Jan 1, 2023

Small Clojure interpreter, linter and formatter.

Small Clojure interpreter, linter and formatter.

Joker is a small Clojure interpreter, linter and formatter written in Go. Installation On macOS, the easiest way to install Joker is via Homebrew: bre

Dec 30, 2022
A Lisp-dialect written in Go
A Lisp-dialect written in Go

Lispy ✏️ Intro Lispy is a programming language that is inspired by Scheme and Clojure. It's a simple Lisp-dialect I built to better understand Lisp an

Dec 8, 2022
Interpreter - The Official Interpreter for the Infant Lang written in Go

Infant Lang Interpreter Infant Lang Minimalistic Less Esoteric Programming Langu

Jan 10, 2022
Yaegi is Another Elegant Go Interpreter
Yaegi is Another Elegant Go Interpreter

Yaegi is Another Elegant Go Interpreter. It powers executable Go scripts and plugins, in embedded interpreters or interactive shells, on top of the Go

Dec 30, 2022
A interpreter of SweetLang, is writed in Go Programming language.

SweetLang ( Soon ) A interpreter of SweetLang, is writed in Go Programming language. SweetLang is made with clarity and simplicity we try to make its

Oct 31, 2021
interpreter for the basic language written in golang
interpreter for the basic language written in golang

jirachi interpreter for the basic language written in golang The plan supports the following functions: Arithmetic Operations (+, -, *, /, ^) Comparis

Sep 17, 2022
Monkey programming language project from 'Writing An Interpreter In Go'and 'Writing A Compiler In Go' Books
Monkey programming language project from 'Writing An Interpreter In Go'and 'Writing A Compiler In Go' Books

Monkey Monkey programming language ?? project from "Writing An Interpreter In Go

Dec 16, 2021
An interpreter written in go for a brainfuck-based language called €*

eurostar-go-interpreter This is an interpreter written in go for a brainfuck-bas

Sep 14, 2022
Gentee - script programming language for automation. It uses VM and compiler written in Go (Golang).

Gentee script programming language Gentee is a free open source script programming language. The Gentee programming language is designed to create scr

Dec 15, 2022
Scriptable interpreter written in golang
Scriptable interpreter written in golang

Anko Anko is a scriptable interpreter written in Go. (Picture licensed under CC BY-SA 3.0, photo by Ocdp) Usage Example - Embedded package main impor

Dec 23, 2022
A POSIX-compliant AWK interpreter written in Go

GoAWK: an AWK interpreter written in Go AWK is a fascinating text-processing language, and somehow after reading the delightfully-terse The AWK Progra

Dec 31, 2022