言語ゲーム

とあるエンジニアが嘘ばかり書く日記

Twitter: @propella

gforth

一週間気ままな事をやっていたが、終わらないうちにまた地味な作業をしないといけなくなってしまったので息抜きに forth を入れてみた。試したのは GNU の gforth。これくらい Cygwin に最初から入っているかなと思ったけど、そんな事は無かったのでソースをダウンロードして普通の gnu のプログラム同様 ./configure; make install でインストール出来る。

$ gforth
Gforth 0.6.2, Copyright (C) 1995-2003 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
3 4 + . 7  ok
bye

ok がイカしてますね。gforth の特徴は emacs との統合です。

  • meadow が info を読めるように info パスを追加
    • (setq Info-directory-list '("c:/cygwin/usr/local/info/" 等など))
  • gforth.el を c:/Meadow/site-lisp/ にコピー

gforth-mode 設定の仕方は info マニュアルにあります。

     (autoload 'forth-mode "gforth.el")
     (setq auto-mode-alist (cons '("\\.fs\\'" . forth-mode)
     			    auto-mode-alist))
     (autoload 'forth-block-mode "gforth.el")
     (setq auto-mode-alist (cons '("\\.fb\\'" . forth-block-mode)
     			    auto-mode-alist))
     (add-hook 'forth-mode-hook (function (lambda ()
        ;; customize variables here:
        (setq forth-indent-level 4)
        (setq forth-minor-indent-level 2)
        (setq forth-hilight-level 3)
        ;;; ...
     )))