Skip to content
/ haskit Public

Haskell library for evaluating expressions using the LuaJIT compiler

License

Notifications You must be signed in to change notification settings

jac3km4/haskit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

haskit

Haskell library for evaluating expressions using the LuaJIT compiler.

The main goal of this project is to implement a parser for a small subset of Haskell and compile it to LuaJIT bytecode in order to make use of runtime JIT optimizations. The expressions to be compiled can be embedded within regular Haskell code using Quasiquotations. Parsing and code generation is done at compile-time so that the resulting executable contains the raw bytecode that can be passed to LuaJIT directly.

This library is in a very early phase and many features remain unimplemented.

Usage

import qualified Foreign.Lua    as Lua
import           Haskit.Quoting

testRun :: IO ()
testRun = print =<< Lua.runLua exec

exec :: Lua.Lua Lua.LuaInteger
exec = do
  _ <- [def|fun x = let y = x + 1000 in x - y|]
  Lua.call 0 0
  Lua.callFunc "fun" $ Lua.LuaInteger 100

About

Haskell library for evaluating expressions using the LuaJIT compiler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published