GNU Guile

出典: フリー百科事典『ウィキペディア(Wikipedia)』
Guileから転送)
GNU Guile
開発元 Free Software Foundation
リポジトリ ウィキデータを編集
対応OS GNUプロジェクト
規格 R5RS
種別 プログラミング言語
ライセンス GNU Lesser General Public License
公式サイト http://www.gnu.org/software/guile/
テンプレートを表示

GNU Guile は、プログラミング言語 Schemeインタープリタ/バーチャルマシン1993年に初めてリリースされた[1]GuilePOSIXシステムコールのモジュール化された拡張やAPL アレイの機能などを含み、オブジェクト[2] ライブラリとしてパッケージングされている。「Libguile」を使うことで、Guileを他のプログラムの中に組み込んで、 他言語との密接な統合が可能なインターフェースとして使用することができる[3]

名前「Guile」は「GNU's ubiquitous interactive language for extension」から来ている。後付けのものではないが(注を参照)公式ウェブページの冒頭にあらわれたのは2011年の春頃である[4]

GuileGNUプロジェクトの「公式の」 拡張言語であるが、 2006年の時点で、人気のあるプロジェクトの中でこの言語を使っているものは十指に満たない。その名称については、Usenetでの議論の中で、リー・トーマス[5]によって提唱された。 基本的なアイデアは、「開発者は基本的なアルゴリズムデータ構造CC++に実装し、機能や型をインタープリタ用のコードにエクスポートする。アプリケーションはインタープリタが統括するプリミティブのライブラリとなることで、コンパイルされたコードの効率とインタープリタの柔軟性の双方を備えることができる。」というものである[6]

Scheme標準への遵守[編集]

その歴史の多くの部分において、GuileScheme標準に厳密に従っていたわけではなかった。

The Guile version of Scheme differs from standard Scheme ([Clinger]) in two ways. First, in Guile Scheme, symbols are case sensitive. Second, in Guile Scheme, there is no distinction made between the empty list and boolean false (between '() and #f).[7]

現在のGuileでは、空のリストとブーリアン型#fは区別される。シンボルの大文字/小文字は区別されるが、Guileのレキシカルスキャナ兼パーサである reader procedure における分岐により、Guileはシンボルでの大文字/小文字の区別をやめることができる。最近採用されたScheme標準R6RSは、R5RS以前の標準から離れて、大文字/小文字の区別をデフォルトとして採用している。

Guileとアプリケーションとの密接な連携にはコストが伴う。Scheme再帰を頻繁に行うので、末尾再帰を最適化した実装を要求するが、ほとんどのテクニックは相互運用性を損なうものである。Guileは、純粋にSchemeの関数やプログラムの中で末尾再帰を最適化するよう妥協し、C言語関数が視野に入ったときは末尾再帰をあきらめるということを強いられる[8]Scheme標準のもうひとつの要求であるcall/cc英語版の実装も、不満足なものである。— C言語で継続を扱うには、C言語のスタック全体をヒープにコピーすることが必要になる[9]ガベージコレクションもまた、効率的なものとはなりえない。C言語のコードはSchemeのコードへのポインタを持つことができなければならないからだ。必要なconsセルの消失を避けるためには、Guileのガベージコレクタは保守的なものにならざるを得ず、再利用される可能性のあるセルを失う可能性がある[10]

歴史[編集]

Guileリチャード・ストールマンによって始められた(のちに「Tcl戦争」と呼ばれることになる)白熱した議論にその起源を発する。ストールマンは、Tclはアプリケーションを記述するには力不足だとし、GNUのアプリケーションを拡張するためにふさわしい言語としてSchemeを提唱して、その結果、Guileプロジェクトが始められた[11] 。 当時、適当なSchemeインタプリタがなかったため、Guileは「隙間」を埋めるために開発された。(のちにarchの開発者となる)トム・ロード[12]シグナスソリューションズ[13]で働いている間にGuileの開発に深くのめりこんだ。初期のバージョンは、1995年よりも以前にSIOD(: Scheme In One Day[14])やSCMインタープリタ[15]から派生した[16]

Guileの目標のひとつは、他の言語からSchemeさらにはポータブルバイトコードへの翻訳を可能にすることである。そうすることで、Guileは効果的な言語中立のランタイム環境となることができる。この目標はいまだ達成されていないが、多くの努力がなされてきた(C言語と類似する構文を持たない他のScheme方言からの、Emacs Lispからの、TkWWWの関係で実装されたTclからの、そしてLOGOの類似言語からの変換が報告されている)。

Guile SchemeXMLXPathXSLT を(SXMLSXPath、SXSLT それぞれにおいて)サポートしている。 S式に基づいたXML処理が guile-lib によって提供されている。

GuileはポータブルなSchemeライブラリSLIBをサポートする。

Guileを使用しているプログラム[編集]

脚注[編集]

  1. ^ Blandy 1997, p. 102.
  2. ^ Strictly speaking, Guile is an object library, not an executable.」 、Blandy、1997年, p.89.
  3. ^ To encourage customization, Guile provides extensive interfaces, allowing C code to interact with the Scheme world. C code can freely create, access, and mutate Scheme objects; C functions may call Scheme functions and vice versa; C code may add new types to the Scheme world and take advantage of Guile's garbage collection… Most of the standard Scheme procedures are implemented by C functions, visible to Guile clients; for example, applications can call the C function scm_cons, which is the underlying implementation of the Scheme procedures cons.Blandy、1997年, pp. 94, 96.
  4. ^ Internet Archive Weyback Machine で確認。2011年1月1日のスナップショットには無いが、同年5月14日のアーカイブにはある。1997年7月のGNU's Bulletin, vol. 1 no. 23 で確認できるので、後付けではない。
  5. ^ The name Guile was first suggested in a Usenet discussion by Lee Thomas.」、Guile Scheme 1995年
  6. ^ Blandy 1997年、pp 87.
  7. ^ An Anatomy of Guile, The Interface to Tcl/Tk」、1995年
  8. ^ Blandy 1997, p. 99.
  9. ^ Because Guile allows C functions and Scheme functions to call each other freely, a Guile continuation may include both C and Scheme stack frames. For simplicity, Guile's implementation of call/cc copies the entire C stack into the heap; invoking a continuation copies the stack back from the heap and uses the longjmp function to reactivate it. This implementation has a number of drawbacks…Blandy、1997年、p. 99.
  10. ^ Blandy、1997年、pp. 99–100.
  11. ^ Tcl war.
  12. ^ : Tom Lord
  13. ^ : Cygnus Solutions。後にレッドハットによって買収された。
  14. ^ SIOD.
  15. ^ It's hard to determine just who designed Guile. A large share of the credit surely belongs to Aubrey Jaffer whose excellent Scheme interpreter, SCM, forms the core of the implementation. The module system was designed and built by Miles Bader…」、 An Anatomy of Guile, The Interface to Tcl/Tk、1995年
  16. ^ Here is a very, very brief history of this interpreter. I hope that people involved in its past will contribute more to this document. SIOD: George Carrette wrote SIOD, the earliest version. Although most of this code as been rewritten or replaced over time, the garbage collector from SIOD is still an important part of Guile. SIOD is still actively developed and freely available (search for "siod"). It has a very small footprint.Guile Scheme、1995年
  17. ^ The rules for the games have been coded for your pleasure in the GNOME scripting language (Scheme).
  18. ^ GnoTime
  19. ^ It is written in pure Guile, and allows configuration files to be written in scheme (as well as Vixie's original format) for infinite flexibility in specifying when jobs should be run.」GNUプロジェクト mcron
  20. ^ OpencCog

参考文献[編集]

  • Guile Scheme」— 仕様と履歴 © FSF(1995年12月)
  • An Anatomy of Guile, The Interface to Tcl/Tk」(1995年)
  • Blandy, Jim (1998). Peter H. Salus. ed (英語). Guile: An Interpreter Core for Complete Applications, Handbook of Programming Languages : Functional and Logic Programming Languages. Volume IV (1st ed.). Indianapolis, IN: マクミラン・テクニカル出版. pp. 87–104. ISBN 1-57870-011-6. OCLC 426167659 

外部リンク[編集]