- 追加された行はこの色です。
- 削除された行はこの色です。
- sml# へ行く。
* SML#をMacにインストールした時のメモ [#oab6bf86]
** SML#とは [#o368b2f9]
SML#は東北大学天気通信研究所が開発を進めているプログラミング言語。
SML#ではStandard MLとの後方互換性, C言事の直接連携, マルチコアCPU上のネイティブスレッドサポートなどの特徴があるプログラミング言語。バックエンドにLLVMを使用している。
[[SML#ホームページ:http://www.pllab.riec.tohoku.ac.jp/smlsharp/ja/]]
** SML#のインストール [#xda659e6]
SML#のインストールには 32bitのGMP(https://gmplib.org )とLLVM3.4(http://llvm.org/releases )が必要
*** GMPの32bit版インストール [#k7a0f3e0]
% ./configure ABI=32 --prefix=インストール先
% make -j
% make install
既存のGMPライブラリとの衝突を防ぐために --prefix オプションをつけると良い.
*** LLVM3.4の32bit版インストール [#v439c77a]
configure時に
% ./configure CC='gcc -m32' CXX='g++ -m32' .....
とつけるそれ以外は基本的に[[LLVM]] を参照
*** SML#のインストール [#g30e8d92]
ソースは公式ホームページに公開している([[ダウンロード先:http://www.pllab.riec.tohoku.ac.jp/smlsharp/ja/?Download]])
% ./configure CC='gcc -m32' CXX='g++ -m32' LD='ld -m elf_i386' LDFLAG="-L/インストールしたGMPのlibへのPATH" --prefix=
% make -j
% make install
でprefix先に bin, libが出来る
% prefix/bin/smlsharp
でsml#の対話モードが立ち上がる
% prefix/bin/smlsharp example.sml
でsml#プログラムをコンパイルできる
** lldbで追う(Cで書かれている部分だけ) [#j5da91e6]
SML#のコンパイラはSML#で書かれているため、lldbでは追うことができない。
ランタイムLibraryはCで書かれているためそれは追うことが可能。
% lldb prefix/bin/smlsharp int.sml
(lldb) target create "../build/bin/smlsharp"
maiCurrent executable set to '../build/bin/smlsharp' (i386).
(lldb) settings set -- target.run-args "int.sml"
(lldb) b main
Breakpoint 1: where = smlsharp`main + 12 at main.c:16, address = 0x0000270c
(lldb) r
Process 1939 launched: '../build/bin/smlsharp' (i386)
Process 1939 stopped
* thread #1: tid = 0x1dcb20, 0x0000270c smlsharp`main(argc=2, argv=0xbffff9fc) + 12 at main.c:16, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000270c smlsharp`main(argc=2, argv=0xbffff9fc) + 12 at main.c:16
13 int
14 main(int argc, char **argv)
15 {
-> 16 sml_init(argc, argv);
17 _SMLmain();
18 sml_finish();
19 return 0;