feat(frontends/lean/notation_cmd): modify infixl/infixr/postfix command syntax

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-06-15 08:28:49 -07:00
parent e7019ec840
commit 9b389a96d5
2 changed files with 4 additions and 3 deletions

View file

@ -11,6 +11,7 @@ Author: Leonardo de Moura
namespace lean {
static name g_max("max");
static name g_colon(":");
static name g_assign(":=");
static std::string parse_symbol(parser & p, char const * msg) {
name n;
@ -71,7 +72,7 @@ environment mixfix_cmd(parser & p, mixfix_kind k) {
"solution: use the 'precedence' command", p.pos());
if (k == mixfix_kind::infixr && *prec == 0)
throw parser_error("invalid infixr declaration, precedence must be greater than zero", p.pos());
p.check_token_next(g_colon, "invalid notation declaration, ':' expected");
p.check_token_next(g_assign, "invalid notation declaration, ':=' expected");
expr f = p.parse_expr();
char const * tks = tk.c_str();
switch (k) {

View file

@ -8,8 +8,8 @@ variable b : N
variable add : N → N → N
variable mul : N → N → N
namespace foo
infixl + : add
infixl * : mul
infixl + := add
infixl * := mul
check a+b*a
end
-- Notation is not avaiable outside the namespace