Leonardo de Moura
0934d7b2f4
fix(frontends/lua): make sure Lua 'sleep' function support interruption
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 13:25:06 -08:00
Leonardo de Moura
d87ad9eb7e
refactor(util/lua): propagate C++ Lean exceptions in Lua
...
The following call sequence is possible:
C++ -> Lua -> C++ -> Lua -> C++
The first block of C++ is the Lean main function.
The main function invokes the Lua interpreter.
The Lua interpreter invokes a C++ Lean API.
Then the Lean API invokes a callback implemented in Lua.
The Lua callback invokes another Lean API.
Now, suppose the Lean API throws an exception.
We want the C++ exception to propagate over the mixed C++/Lua call stack.
We use the clone/rethrow exception idiom to achieve this goal.
Before this commit, the C++ exceptions were converted into strings
using the method what(), and then they were propagated over the Lua
stack using lua_error. A lua_error was then converted into a lua_exception when going back to C++.
This solution was very unsatisfactory, since all C++ exceptions were being converted into a lua_exception, and consequently the structure of the exception was being lost.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 12:25:29 -08:00
Leonardo de Moura
99a811a586
feat(bindings/lua): expose io_state object in the Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-26 12:54:47 -08:00
Leonardo de Moura
861be072d8
feat(bindings/lua): add proof_state to Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-26 11:34:58 -08:00
Leonardo de Moura
fd3b9e39f6
feat(bindings/lua): add cex_builder to Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-26 09:17:57 -08:00
Leonardo de Moura
4d9075bdfd
feat(bindings/lua): add proof_map, assignment and proof_builder to Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-26 08:37:37 -08:00
Leonardo de Moura
3ebc099ec5
feat(bindings/lua/options): improve options Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-25 21:05:05 -08:00
Leonardo de Moura
feeb6d9105
feat(bindings/lua): add goal object to Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-25 20:51:47 -08:00
Leonardo de Moura
7b8bd97699
feat(lua/expr): add method for extracting semantic attachment data
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-19 19:06:47 -08:00
Leonardo de Moura
a98fdd9be6
refactor(shell): combine lean and leanlua executables in a single executable
...
The main motivation is to allow users to configure/extend Lean using .lua files before loading the actual .lean files.
Example:
./lean extension1.lua extension2.lua file.lean
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-19 16:48:21 -08:00
Leonardo de Moura
87775cbc07
chore(build): include incorrect output in the logs
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-18 15:39:55 -08:00
Soonho Kong
20756c382c
test(*): split leantests, leanslowtests, leanluatests, leanluadocs into singletons
2013-11-18 18:27:11 -05:00
Leonardo de Moura
b2d1acd0b7
test(lua/environment): add missing tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-18 09:27:46 -08:00
Leonardo de Moura
1315378ebb
test(*): add missing tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-18 09:13:34 -08:00
Leonardo de Moura
7976937e4c
test(lua/metavar_env): add missing tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-17 19:18:47 -08:00
Leonardo de Moura
69be5f6c94
feat(kernel/environment): track which modules were already imported
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-17 18:15:44 -08:00
Leonardo de Moura
5f651d46e6
tests(lua/frontend_lean): add missing tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-17 13:48:29 -08:00
Leonardo de Moura
df94e44806
test(lua/expr): add missing tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-17 11:46:24 -08:00
Leonardo de Moura
e693c2de01
test(lua/name): add missing tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-17 11:25:21 -08:00
Leonardo de Moura
8a13df3ce1
test(lua/type_inferer): add missing tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-17 11:17:32 -08:00
Leonardo de Moura
f586e58ac3
test(lua/justification): add more tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-17 11:13:10 -08:00
Leonardo de Moura
d0bac61e74
fix(lua/numerics): bug in bindings, add more tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-17 11:02:44 -08:00
Leonardo de Moura
926ed0a02d
feat(lua): add type_inferer object to Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-16 19:18:15 -08:00
Leonardo de Moura
590b14570f
feat(lua): improve error handling in Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-16 18:21:42 -08:00
Leonardo de Moura
390f7eaec8
test(kernel/typechecker): type checker
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-16 15:01:39 -08:00
Leonardo de Moura
9398ea5a59
feat(util/shared_mutex): add support for recursive lock at shared_mutex
...
We need support for recursive locks. The main user of this class is
the environment object. This commit adds a test that demonstrates that
the shared_lock of the environment object may be recursively requested.
Before this fix, the Lean was deadlocking in this example.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-15 22:01:11 -08:00
Leonardo de Moura
209a2d10f7
fix(lua): replace std::mutex with std::recursive_mutex, add test that demonstrates the problem that is being fixed
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-15 21:26:16 -08:00
Leonardo de Moura
8525e8534b
feat(lua): expose parse_expr and parse_commands from frontends/lean in the Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-15 16:11:26 -08:00
Leonardo de Moura
a74412963a
chore(build): only execute lua multi-threading tests when on cygwin or linux, and using g++
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-15 09:27:58 -08:00
Leonardo de Moura
5e170ce5fe
chore(tests/lua): move examples that use threads to tests/lua/threads
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-15 09:11:58 -08:00
Leonardo de Moura
b5dcb93550
feat(lua): communication channels for threads
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 21:10:46 -08:00
Leonardo de Moura
3a924a5fb1
perf(lua/name): improve to_name_ext performance
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 18:06:09 -08:00
Leonardo de Moura
45858d54ae
test(frontends/lean): add missing expected output
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 15:51:47 -08:00
Leonardo de Moura
6b30ebab5e
test(lua): use simplified Const creation
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 15:17:00 -08:00
Leonardo de Moura
09bed4786c
feat(lua): add semantic attachments for builtin arithmetical values to Lua API, improve mk_constant
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 15:15:04 -08:00
Leonardo de Moura
abe93dfec0
fix(lua/splay_tree): for_each method was crashing if the map was updated during for_each
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 13:48:23 -08:00
Leonardo de Moura
64cce595a5
feat(lua): add splay_maps to the Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 13:35:36 -08:00
Leonardo de Moura
9e445d1917
feat(lua): interrupt and sleep Lua APIs
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 10:04:32 -08:00
Leonardo de Moura
691893258d
feat(kernel/expr): add hash code based on allocation time
...
The new hash code has the property that given expr_cell * c1 and expr_cell * c2,
if c1 != c2 then there is a high propbability that c1->hash_alloc() != c2->hash_alloc().
The structural hash code hash() does not have this property because we may have
c1 != c2, but c1 and c2 are structurally equal.
The new hash code is only compatible with pointer equality.
By compatible we mean, if c1 == c2, then c1->hash_alloc() == c2->hash_alloc().
This property is obvious because hash_alloc() does not have side-effects.
The test tests/lua/big.lua exposes the problem fixed by this commit.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 02:43:11 -08:00
Leonardo de Moura
ae7ea99b56
fix(lua): copy_values and add tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 21:31:27 -08:00
Leonardo de Moura
c759fc93f7
test(lua): object Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 20:59:28 -08:00
Leonardo de Moura
351ef867d2
feat(lua): add abstract, instantiate, has_free_vars, lift/lower free_vars to Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 17:02:49 -08:00
Leonardo de Moura
ed3cf8152b
feat(lua): add for_each to expr Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 16:30:59 -08:00
Leonardo de Moura
3dea7ae0d6
test(frontends/lean): example mixing Lean and Lua
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 16:07:15 -08:00
Leonardo de Moura
1bf6051866
test(lua): expr LUA API test
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 15:29:31 -08:00
Leonardo de Moura
9a22702383
feat(lua): make objects() and localobjects() methods return iterators in the environment LUA API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 14:26:01 -08:00
Leonardo de Moura
8c52d47692
chore(lua): rename env() to get_env()
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 13:58:51 -08:00
Leonardo de Moura
a80adae1c3
feat(lua): add fields method to sexpr Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 12:10:24 -08:00
Leonardo de Moura
450128e28b
refactor(lua): cleanup Lua bindings, and add accessor/tester to expr Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 11:46:09 -08:00
Leonardo de Moura
be093ecf90
feat(lua): use formatter available in the state object to convert Lean objects into strings in the Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 16:56:30 -08:00