ファイルを
- module1.fs
- module2.fs
- test.fs
の3つに分けてコンパイルする。
これらの結果がおま環なのかは不明。
検証不十分。
# Brainf*ck Code Generator (固定文字列表示のみ) | |
# Author: Leonardone @ NEETSDKASU | |
# License: MIT License | |
def test_genBF() | |
f = 'TextFile.txt' | |
ARGV << f if ARGV.empty? && ARGF.eof? && FileTest.exist?(f) | |
puts genBF(ARGF.read, 60, 10) if !ARGF.eof? | |
end |
-- Data.Text.split の代替(?) | |
s = ",1,2,345,6,,7,8," | |
x = split (== ',') s -- x = ["","1","2","345","6","","7","8",""] | |
split :: (a -> Bool) -> [a] -> [[a]] | |
split f str = loop str where | |
loop [] = [[]] | |
loop t = case s of | |
[] -> [w] |
-- Data.List.Split.splitOn や Data.Text.splitOn の代替(?) | |
import Data.List(isPrefixOf) | |
s = "bc k abcd Efg abc b c xyz bcbc xyz bc" | |
d = "bc" | |
x = splitOn d s -- x = [""," k a","d Efg a"," b c xyz ",""," xyz ",""] | |
splitOn :: Eq a => [a] -> [a] -> [[a]] | |
splitOn [] str = error "splitOn: empty input" -- Data.Textのはエラーだが、Rubyみたいに文字単位分割したいなら [[c] | c <- str] |
# INTERCAL CODE GENERATOR (固定テキスト表示のみ) | |
# Author: Leonardone @ NEETSDKASU | |
# License: MIT License | |
# Target: Intercal c-intercal 28.0-r1 | |
def test_genIC() | |
f = 'TextFile.txt' | |
ARGV << f if ARGV.empty? && ARGF.eof? && FileTest.exist?(f) | |
puts genIC(ARGF.read, false) if !ARGF.eof? | |
end |
# Unlambda Code Generator (半角文字の固定テキスト表示のみ) | |
# Autohr: Leonardone @ NEETSDKASU | |
# License: MIT License | |
# Target: unlambda-2.0.0 | |
def test_genUL() | |
f = 'TextFile.txt' | |
ARGV << f if ARGV.empty? && ARGF.eof? && FileTest.exist?(f) | |
puts genUL(ARGF.read, 0, 60) if !ARGF.eof? | |
end |
概要
生成するアプリケーション(アセンブル?)に
アプリケーションタイトルやバージョン番号などのメタ情報を含める
参考にした情報:
// parse arguments | |
// author : Leonardone @ NEETSDKASU | |
// license: MIT | |
// 他の関数の引数を仕分ける | |
//////////////////////////////////////////////////////////////////////////////// | |
// parseArguments(args, xpnd) | |
// args ... 仕分け対象の関数の引数 (自動変数 arguments を渡す) | |
// xpnd ... 仕分け方の配列 | |
//////////////////////////////////////////////////////////////////////////////// |
// permutation | |
// author : Leonardone @ NEETSDKASU | |
// license: MIT | |
createPermutationIter = (function() { | |
var funcName = "createPermutationIter"; | |
function errmsg(s) { return "[" + funcName + "] Error! " + s; } | |
var defaultMethod_getNext = "getNext"; | |
var defaultMethod_hasNext = "hasNext"; |