GithubHelp home page GithubHelp logo

x-scala's Introduction

eXtensible-Scala(X-Scala)

Scala言語向けHygienic構文マクロシステム

以下では,このファイル(README.md)が置かれているディレクトリをホームと呼びます.

他に必要なシステム

http://www.littlewingpinball.net/mediawiki-ja/index.php/Ypsilon_Scheme_Systemのインストール方法に従ってください.

Node.js

Homebrew(http://brew.sh/)が入っていれば, brew install Node 入っていない場合はこちらからインストールしてください → http://nodejs.org/

ホームで npm install pegjs

ホームで npm install sexpression

動作確認

  • OS : Mac OS X 10.9.1
  • Ypsilon : Ypsilon 0.9.6-trunk/r506
  • Node.js : v0.10.24
  • PEG.js : PEG.js 0.8.0
  • sexpression : sexpression 0.0.4

使い方

環境変数XSCALA_HOMEにホームの絶対パスを入れてください.

例: export XSCALA_HOME=/Users/USER_NAME/Desktop/x-scala

scalaディレクトリで

./convert.sh [ファイル名].scala

とコマンドを呼ぶことで[ファイル名]ディレクトリが作られ,その下にマクロ展開の結果とその中間ファイルが生成されます.

  • 1_midtree.json:マクロ定義のパターン構文木
  • 2_macroParser.pegjs:マクロ定義のパターンのPEG
  • 3_syncedMacroParser.pegjs:X-ScalaのPEG
  • 4_tree.json:X-Scalaの構文木
  • 5_sform.scm:X-Scalaから変換したS式
  • 6_expanded.scm:マクロ展開されたS式
  • 7_expanded.scala:S式から逆変換されたScalaプログラム

macro_testディレクトリ以下にサンプルがあります.

例: macro_testディレクトリで

../convert.sh hygienic.scala

でhygienicディレクトリが作られ,マクロ展開を行ったプログラムが生成されます.

注意

変数宣言や関数定義,型エイリアスはスコープの先頭にまとめてください. 正しくマクロ展開されないことがあります.

2014/02/26

x-scala's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.