Commit graph

1328 commits

Author SHA1 Message Date
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
c4c548dc5d feat(*): simplify interrupt propagation
Instead of having m_interrupted flags in several components. We use a thread_local global variable.
The new approach is much simpler to get right since there is no risk of "forgetting" to propagate
the set_interrupt method to sub-components.

The plan is to support set_interrupt methods and m_interrupted flags only in tactic objects.
We need to support them in tactics and tacticals because we want to implement combinators/tacticals such as (try_for T M) that fails if tactic T does not finish in M ms.
For example, consider the tactic:

    try-for (T1 ORELSE T2) 5

It tries the tactic (T1 ORELSE T2) for 5ms.
Thus, if T1 does not finish after 5ms an interrupt request is sent, and T1 is interrupted.
Now, if you do not have a m_interrupted flag marking each tactic, the ORELSE combinator will try T2.
The set_interrupt method for ORELSE tactical should turn on the m_interrupted flag.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 21:45:48 -08:00
Leonardo de Moura
b31233e8c2 feat(util/interrupt): restore interrupt module
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 21:16:10 -08:00
Soonho Kong
e1047c4ebb chore(travis): fix .travis.osx.yml 2013-11-12 23:15:03 -05:00
Leonardo de Moura
126c45626c chore(memcheck.supp): add suppressions for LuaJIT bugs
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 18:52:03 -08:00
Leonardo de Moura
e96fe9b6e6 chore(build): exclude leanslowtests from OSX debug regression
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 18:48:19 -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
Leonardo de Moura
9a5f86fce6 feat(lua): use (** ... **) instead of {{ ... }} for nested Lua scripts
The token }} is a bad delimiter for blocks of Lua script code nested in Lean files.
The problem is that the sequence }} occurs very often in Lua code because Lua uses { and } to build tables/lists/arrays.
Here is an example of Lua code that contains the sequence }}
     t = {{1, 2}, {2, 3}, {3, 4}}

In Lean, (* ... *) is used to create comments. Thus, (** ... **) code blocks will not affect
valid Lean files. It also looks reasonably good.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 16:05:49 -08:00
Leonardo de Moura
8190d4fed5 feat(lua): allow Lua scripts to update 'global' options
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 15:38:00 -08:00
Leonardo de Moura
0a6f622aec chore(build): remove CheckLuaObjlen, it is easier to check the Lua version
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 12:58:22 -08:00
Leonardo de Moura
b986af09ed feat(lua): add support for copying closures between Lua states
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 12:54:34 -08:00
Leonardo de Moura
c46edcf370 feat(lua): expose formatter in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 11:19:15 -08:00
Leonardo de Moura
2af2a69fc6 feat(lua): expose kernel objects in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 09:40:29 -08:00
Leonardo de Moura
d257156b88 fix(lua): memory leaks, we should not use luaL_error because it does not unwind C++ stack
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 21:45:13 -08:00
Leonardo de Moura
a30e02d862 fix(lua): redefine Lua 'print' function, and make sure it is thread safe
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 21:15:21 -08:00
Leonardo de Moura
eb9d0f0552 test(lua): add example showing how to access/update an environment object using multiple threads
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 20:53:23 -08:00
Leonardo de Moura
0af8f17834 feat(lua): allow Booleans to be copied between Lua states
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 20:39:46 -08:00
Leonardo de Moura
7cb15cdac5 feat(lua): allow environment object references to be moved between Lua states
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 20:32:36 -08:00
Leonardo de Moura
ac6c18321a fix(lua): make sure environment objects can be safely accessed/updated from current threads
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 20:29:53 -08:00
Leonardo de Moura
596e4aeb57 feat(util/shared_mutex): add shared_mutex object, this is a temporary replacement for std::shared_mutex that will be available in C++11
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 20:00:21 -08:00
Leonardo de Moura
2ac594a159 test(lua): add a new example showing how to create nested State objects and threads
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 18:27:09 -08:00
Leonardo de Moura
cc7b5b7e50 fix(lua): disable custom allocation for Lua, it is crashing
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 18:20:52 -08:00
Leonardo de Moura
7d49df3985 style(lua): fix cpplint.py warnings
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 17:46:39 -08:00
Soonho Kong
d4e515f38e doc(README.md): "Code coverage" => "Coverage" to fit in one line
[skip ci]
2013-11-11 20:42:15 -05:00
Soonho Kong
2bdc8d0370 doc(README.md): use horizontal layout for the badges
simplified the title (i.e. from Ubuntu 12.04 LTS => Ubuntu), however, the detailed information are still accessible by positioning mouse over the icons.

[skip ci]
2013-11-11 20:40:32 -05:00
Soonho Kong
ed4526a4f0 doc(coding_style.md): add section about git pre-push hook
[skip ci]
2013-11-11 20:18:38 -05:00
Leonardo de Moura
69b41eae70 feat(lua): add support for multiple execution threads in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 16:25:17 -08:00
Leonardo de Moura
95785c7aaa feat(lua): add State objects, it allows us to create several Lua State objects in a lua script
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 15:05:50 -08:00
Leonardo de Moura
f158b0b311 fix(util/memory): make sure realloc behaves like free when sz == 0
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 13:42:22 -08:00
Leonardo de Moura
7cc6c35eee feat(lua/name): add hash method to name objects
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 13:32:56 -08:00
Leonardo de Moura
bdc23fba32 test(lua): add tests for expr object
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 13:11:31 -08:00
Leonardo de Moura
8dd85ebc15 fix(lua): typos and a bug in the expr Lua bindings
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 13:11:06 -08:00
Leonardo de Moura
b227775a07 test(lua): add tests for format object
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 12:58:47 -08:00
Leonardo de Moura
c2db18a003 test(lua): add tests for sexpr object
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 09:51:07 -08:00
Leonardo de Moura
6c7be28807 test(lua): add tests for options object
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 09:42:50 -08:00
Leonardo de Moura
31abc00db8 chore(*): add LCOV_EXCL_LINE to lean_unreachable statements
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 09:19:38 -08:00
Leonardo de Moura
dbdb9a41af style(lua): use C++-style cast
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
7683188ab0 chore(emplace_back): use emplace_back when appropriate
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
8c140ff86f feat(lua): allow lua scripts (embedded in Lean files) to access the environment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
3078923ea4 fix(kernel/type_checker): add missing test, and kernel_exception has_no_type_exception
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
9d61fcf85b feat(lua): expose environment objects in the Lua bindings
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
119e0ba5e6 feat(lua): add to_nonnull_expr
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
8dd62e76be feat(lua): add mk_metavar to Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Soonho Kong
46edc11fd8 doc(README.md): add coveralls.io's coverage badge 2013-11-10 02:11:50 -05:00
Soonho Kong
b1916721f2 chore(travis): update coveralls.io repo token 2013-11-10 02:04:27 -05:00
Soonho Kong
27710a778a chore(travis): use gcov-4.8 on ubuntu 2013-11-10 01:52:47 -05:00
Soonho Kong
7831b534ba chore(travis): fix lcov permission problem 2013-11-10 01:44:50 -05:00
Soonho Kong
6a2dfe7765 chore(travis): add coveralls.io support 2013-11-10 00:52:32 -05:00
Soonho Kong
1cf037f11e chore(cmake): do not delete coverage.info.cleaned which will be used for coveralls.io 2013-11-09 22:19:08 -05:00
Leonardo de Moura
6b71fb346c fix(lua): add missing files for local_context
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-09 12:47:52 -08:00