Squeak − SmaCC
先人の足跡を忠実になぞるべく。
以下SmaCCの試用の試行錯誤の痕。
環境:SqueakNihongo7.zip + Squeak-Win32-3.7.1-VM-Imm.zip + SqueakV3.sources.zip
http://squeakland.jp/plugin/download.html
1.ダウンロードファイルを解凍
2.SqueakNihongo7.imageをSqueak.exeにドラッグ&ドロップする。→Squeak起動。
3.左クリック→開く...→SqueakMapパッケージ・ローダー
4.SmaCC Development for <= 3.8のVer10、SmaCC RuntimeのVer4、RefactoringBrowserをインストール(全部必要なのかは不明)(追記:要りそう。RBでエラーがでるけど適当に)
5.http://www.refactory.com/Software/SmaCC/Tutorial.htmlを参考にサンプルを入力。
Scannerタブ
: [0-9]+ (\. [0-9]*) ? ;
: \s+; Parserタブ
Expression :
Expression "+" Number
| Number ;
Number :; Compileタブ
ScannerClass:CalcScanner
ParserClass:CalcParser
6.CompileLALR(1)ボタンをクリック
7.Testタブで
4 + 1
を入力
8.Parseボタンをクリック。ParsesWithoutErrorsでOK。