今回は、割と言語のコアな部分だけれど(VMじゃなくて)ライブラリ実装になってる部分を拾っておきます。 Luaには「coroutine(コルーチン)」という機能があって、Lua 5.0のVMのデザインもこれを楽に実装するために採用された面もあるらしいので、VMを学ぶにあたって重要なポイントです。こんな機能。 function countUp() local n = 0 while true do coroutine.yield(n) -- 対応するcoroutine.resumeにnを返す n = n+1 end end co = coroutine.create(countUp) repeat f,a = coroutine.resume(co) -- countUp実行開始、あるいはyieldから実行再開 print(a) until a>=10 他の言語でもよくある「スレッド」に似てい
Introduction LPeg is a pattern-matching library for Lua, based on Parsing Expression Grammars (PEGs). This text is a reference manual for the library. For those starting with LPeg, Mastering LPeg presents a good tutorial. For a more formal treatment of LPeg, as well as some discussion about its implementation, see A Text Pattern-Matching Tool based on Parsing Expression Grammars. You may also be i
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く