Skip to content

Instantly share code, notes, and snippets.

@viercc
Created October 23, 2019 13:49
Show Gist options
  • Save viercc/d9da8c4dd2f3e23e6f5e79efa7c286d6 to your computer and use it in GitHub Desktop.
Save viercc/d9da8c4dd2f3e23e6f5e79efa7c286d6 to your computer and use it in GitHub Desktop.
Blawn(https://github.com/Naotonosato/Blawn) バグレポート
class Foo()
// フィールドが一つもないクラスを定義し、そのクラスのオブジェクトを作ると
// コンパイラ自体がSegmentation Faultを起こす
//@one_field = 0
@function g()
ans = "0"
return ans
x = Foo()
print("WTF")
class Foo()
@foo_value = "0"
@function g()
ans = self.foo_value
return ans
// 以下のコードが(不必要に)シンタックスエラーとされる。
// 原因は恐らくlexerのバグ。
// "c."から始まる識別子がC_FUNCTIONというトークンとして扱われている
// が、そんなトークンは文法(parser.yy)で参照されていない
c = Foo()
x = c.g()
// ちなみにこれはコンパイルが通る
y = c .g ()
print("WTF")
// グローバル変数の型と引数として期待する型が一致する場合
// コンパイラは受け入れるけれども、出力されるLLVMのIRは
// 壊れているみたい
// (llcを呼んだときにエラーが出る)
y = "y"
function g(y)
print(y)
return
g("string")
x = 100
// スコープにある変数名と同じ名前の仮引数名を付けられない
function f(x)
print(x)
return
f("string")
class Loop(msg)
// 自分自身のメソッドを呼び出すクラスを作ると、
// コンパイラのSegmentation Fault
@msg = msg
@function run(n)
if n > 0
(
print(self.msg)
self.run(n-1)
)
return
looper = Loop("Beep!")
looper.run(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment