Syntax highlighter

2013-09-08

SRFI 110

Today the SRFI 110 will be the final state (according to the latest ML topic). So for the celebration, I have supported it on Sagittarius.

Basically I have only added compatible layer to the reference implementation and run some scripts. There is one exception which is not satisfying requirement. That is, again the same as previous curly-infix SRFI, hash-bang directive. I don't have any intention to support these SRFIs in core Sagittarius so it's always uses reader macro or replaceable reader. So to use this SRFI on Sagittarius, it must look like this;
;; #!sweet for compatibility
#!sweet
#!reader=sweet

define factorial(n)
  if {n <= 1}
     1
     {n * factorial{n - 1}}

print(factorial(10))

define a 4

define g(x y)
  {x * y}

let <* x sqrt(a) *>
! g {x + 1} {x - 1}
It might not be a big issue as usual.

The good thing about this SRFI is that it can be used in real world. If you are familiar with Python or Ruby which I don't know much about, this might be a good alternative. So the next step for this would be an Emacs lisp to support this :)

Well, again (the same as SRFI 105) I don't think I use this SRFI but it's always good to have choices for users.

4 comments:

Anonymous said...

話にきくsrfi-49を実際に使ってみたいと思っていたところ、この処理系を見つけました。
さらに、srfi-110にも対応していることを発見して感激です。
しかし、上記のサンプルコードを実行してみましたが、以下のエラーが出ます。
バージョン0.9.7で動かすにはどうすればいいでしょうか?

Unhandled exception
Condition components:
1. &undefined
2. &who n
3. &message unbound variable n in library user
4. &stack-trace

stack trace:
[1] eval
[2] main-loop
[3] dynamic-wind
[4] script

Anonymous said...

自己解決しました。
#!reader=sweetの次の行に
(import (sweet))
を書いたら動かすことができました。
でも、できれば以前のように、#!の行を書くだけの方がよかったな…。

Anonymous said...

たびたびすみません。
sweet.scmはすでに読み込まれており、
#!reader=sweet
'dummy
print 'hello
のように、readに一度空読みをさせられれば何でもいいようです。

kei said...

コメントに今更ながら気づきました。どちらかというとバグっぽい挙動ですね。

Post a Comment