Leonardo de Moura
fb09fc9fe6
feat(lua): add set_global_function template, and to_name_ext function
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 21:54:57 -08:00
Leonardo de Moura
db8b16641c
chore(build): check if the Lua installed in the system supports lua_newstate
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 21:54:57 -08:00
Leonardo de Moura
9000c7c2fa
feat(lua): expose format objects in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 21:54:42 -08:00
Leonardo de Moura
6f432b4094
feat(lua): make Lua use our malloc/realloc, catch error when initializing Lua
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 15:52:39 -08:00
Leonardo de Moura
30d54fa483
chore(todo): update todo list
2013-11-07 15:25:03 -08:00
Leonardo de Moura
a16c41c2c7
chore(todo): update todo list
2013-11-07 15:24:41 -08:00
Leonardo de Moura
9c18439eb2
chore(todo): update todo list
2013-11-07 15:24:09 -08:00
Leonardo de Moura
57b9657bf0
feat(lua): add lua_exception for wrapping lua errors, and improve Lua error messages in the Lean frontend
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 15:19:26 -08:00
Leonardo de Moura
a9b2be0b9c
feat(frontends/lean): add support for embedded Lua scripts in Lean files
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 13:56:04 -08:00
Leonardo de Moura
ff16ffaea3
fix(kernel/environment): warning produced by clang
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 11:36:08 -08:00
Leonardo de Moura
8012c4f644
fix(kernel/environment): add weak reference to environment objects
...
We need weak references to environment objects because the environment has a reference to the type_checker and the type_checker has a reference back to the environment. Before, we were breaking the cycle using an "environment const &". This was a dangerous hack because the environment smart pointer passed to the type_checker could be on the stack. The weak_ref is much safer.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 11:29:08 -08:00
Leonardo de Moura
9c60eed93c
refactor(kernel/metavar): avoid using unique names for default metavariable prefix
...
The problem is that unique names depend on the order compilation units are initialized. The order of initialization is not specified by the C++ standard. Then, different compilers (or even the same compiler) may produce different initialization orders, and consequently the metavariable prefix is going to be different for different builds. This is not a bug, but it makes unit tests to fail since the output produced by different builds is different for the same input file.
Avoiding unique name feature in the default metavariable prefix avoids this problem.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 10:16:25 -08:00
Leonardo de Moura
2141ee12f4
refactor(frontends/lean): use extension objects to store lean default frontend data in the environment
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 10:00:12 -08:00
Leonardo de Moura
80e23f98c7
feat(kernel/environment): add environment extension objects, the environment can be extended with frontend specific objects
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-06 19:22:30 -08:00
Soonho Kong
6cb282d70b
chore(travis): split a memcheck build into two builds using range option (-I)
2013-11-06 13:49:14 -05:00
Soonho Kong
c7c0905c4f
chore(travis): use cmake-2.8.7 for windows build
2013-11-06 13:49:14 -05:00
Soonho Kong
c5fd828a71
chore(cmake): switch the ordering between gmp and mpfr
2013-11-05 19:31:10 -05:00
Soonho Kong
07737d3a4b
chore(travis): enforce windows build to use cmake-2.8.11.2
2013-11-05 19:31:10 -05:00
Leonardo de Moura
e7d508043b
fix(lua/numerics): errors when cross-compiling for Windows
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-05 13:35:34 -08:00
Leonardo de Moura
76150620c3
test(lua): use assertions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-05 13:21:01 -08:00
Leonardo de Moura
40fde1a69c
test(lua): invoke Lua binding tests from ctest
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-05 13:17:10 -08:00
Leonardo de Moura
ba3faea586
test(lua): add test driver for Lua binding tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-05 13:11:34 -08:00
Leonardo de Moura
0cc475e581
fix(lua/sexpr): make sexpr bindings robust
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-05 13:03:32 -08:00
Leonardo de Moura
055cc7f957
fix(lua): make testudata compatible with Lua 5.1
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-05 11:35:09 -08:00
Soonho Kong
19c4a3b626
chore(travis): update to use mxe-gcc-4.8.2.tar.bz2
...
- fix compatibility problem with cmake-2.8.12
- update g++ version from 4.8.1 to 4.8.2
- include lua
2013-11-05 02:55:16 -05:00
Leonardo de Moura
5a01f167df
fix(lua): expose missing functions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 21:33:33 -08:00
Leonardo de Moura
56344c0541
test(lua): add more s-exprs Lua tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 21:31:29 -08:00
Leonardo de Moura
0ac8f2d8d9
feat(lua/sexpr): improve sexpr Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 21:28:17 -08:00
Leonardo de Moura
f13a97397f
feat(lua): expose s-expressions in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 19:58:32 -08:00
Leonardo de Moura
1e12ddc7a9
refactor(lua): add goodies for accessing Lean values on the Lua stack
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 19:45:15 -08:00
Leonardo de Moura
47c289a24b
refactor(lua/name): improve name bindings for Lua
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 18:48:21 -08:00
Leonardo de Moura
3c475e890d
refactor(lua/options): improve options bindings for Lua
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 18:46:58 -08:00
Leonardo de Moura
7b77863507
refactor(lua/name): improve name bindings for Lua
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 18:44:20 -08:00
Leonardo de Moura
f488e6bbfc
fix(lua): safe_function_wrapper
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 18:12:53 -08:00
Leonardo de Moura
92b2591a6f
style(lua): add missing include
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 16:29:47 -08:00
Leonardo de Moura
32d3990fc7
fix(lua): problem when compiling with clang++
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 15:05:04 -08:00
Leonardo de Moura
0579970fc5
feat(lua): expose options object in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 14:38:49 -08:00
Leonardo de Moura
543aea65c9
chore(lua): rename init_* functions to open_*
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-04 13:54:51 -08:00
Leonardo de Moura
fd7e85f0bb
feat(lua): add safe_function template that catches Lean and C++ exceptions and convert them into Lua errors
...
I'm using the approach described at:
http://stackoverflow.com/questions/4615890/how-to-handle-c-exceptions-when-calling-functions-from-lua
BTW, in some Lua versions, the C++ exceptions are correctly propagated.
I think we should not rely on features of particular implementations.
For example, LuaJIT does not propagate C++ exceptions.
Whenever an exception is thrown from C++ code invoked from LuaJit, LuaJit interrupts the execution and converts it to an error "C++ exception".
On the other hand, Lua 5.2 PUC-Rio interpreter (for Ubuntu) seem to propagate the C++ exceptions.
The template safe_function solves the issue. It will also produce a Lua error whenever the function being wrapped throws an exception. The error message is based on the "what()" method.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-03 14:42:57 -08:00
Leonardo de Moura
1a734979b4
fix(shell/lua): catch lean exceptions in the leanlua frontend
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-03 13:46:15 -08:00
Leonardo de Moura
6f2183fafe
feat(FindLua.cmake): search also for LuaJit
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-03 13:45:23 -08:00
Leonardo de Moura
9884c056ce
feat(lua): allow Lean to be compiled with Lua 5.1 and LuaJit
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-03 12:40:44 -08:00
Leonardo de Moura
df7dbe17b5
feat(lua/util): remove dependency on luaL_setfuncs
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-03 12:16:23 -08:00
Leonardo de Moura
e2da8c1f4d
feat(lua/numerics): expose mpz and mpq numbers in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-03 12:05:54 -08:00
Soonho Kong
88ebdbcfb6
fix(shell/lua): move "#include<iostream>"
2013-11-03 13:25:33 -05:00
Soonho Kong
a9d55bf036
fix(lua): use updated FindLua and check version 5.2
2013-11-03 13:24:46 -05:00
Soonho Kong
044813615e
fix: add '#include <tuple>'
2013-11-03 13:00:42 -05:00
Soonho Kong
0d0d0cd533
chore(cmake): add gmp/mpfr include paths to cmakelists.txt
2013-11-03 13:00:42 -05:00
Leonardo de Moura
ccd95a9b66
fix(lua/name): fix memory leak
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-02 20:57:41 -07:00
Leonardo de Moura
dbf2d56c77
feat(lua/name): expose hierarchical names in the Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-02 20:49:42 -07:00