Commit graph

21519 commits

Author SHA1 Message Date
Leonardo de Moura
fb2fea2744 fix: explicit syntax kind in macro_rules 2020-10-10 06:42:45 -07:00
Leonardo de Moura
6a808540d5 chore: remove macro println! 2020-10-09 20:53:44 -07:00
Leonardo de Moura
9538772c1c chore: do not use string interpolation by default at dbgTrace!
It is nice to be able to write `dbgTrace! x` instead of `dbgTrace! "{x}"`
2020-10-09 20:49:39 -07:00
Leonardo de Moura
be252743b3 feat: add string interpolation for MessageData 2020-10-09 20:43:26 -07:00
Leonardo de Moura
b4ef8de1a5 test: new frontend tests 2020-10-09 18:21:45 -07:00
Leonardo de Moura
f375b3ce8c chore: update stage0 2020-10-09 17:42:46 -07:00
Leonardo de Moura
2151052b79 chore: move Log.lean to new frontend 2020-10-09 17:38:35 -07:00
Leonardo de Moura
719f384d69 chore: move DefView to new frontend 2020-10-09 17:26:54 -07:00
Leonardo de Moura
bca81714fe feat: println! and dbgTrace! macros with string interpolation 2020-10-09 17:19:04 -07:00
Leonardo de Moura
ef27af9cf8 test: string interpolation 2020-10-09 17:02:12 -07:00
Leonardo de Moura
51dc10dd93 feat: array slicing notation 2020-10-09 16:40:18 -07:00
Leonardo de Moura
2264369458 chore: update stage0 2020-10-09 16:27:41 -07:00
Leonardo de Moura
3bd75d51d5 feat: add ParserDescr.noWs 2020-10-09 16:26:49 -07:00
Leonardo de Moura
e021a7d011 chore: remove symbolNoWs
@Kha This is a leftover from the time precedence was associated with
tokens instead of parsers.
2020-10-09 16:17:56 -07:00
Leonardo de Moura
90b935b9ea chore: update stage0 2020-10-09 16:09:31 -07:00
Leonardo de Moura
5a40d9eb13 feat: add Subarray 2020-10-09 16:06:24 -07:00
Leonardo de Moura
ec5aa511a4 chore: move Level.lean to new frontend 2020-10-09 14:57:14 -07:00
Leonardo de Moura
a621256b10 fix: unintended overload 2020-10-09 14:56:11 -07:00
Leonardo de Moura
749e2063cf feat: add interpolated string for toString 2020-10-09 14:38:24 -07:00
Leonardo de Moura
28d4b2380d chore: update stage0 2020-10-09 14:20:03 -07:00
Leonardo de Moura
6020e6682a feat: process interpolatedStr in the elaborator 2020-10-09 14:18:45 -07:00
Leonardo de Moura
454ea58056 chore: update stage0 2020-10-09 14:05:49 -07:00
Leonardo de Moura
7013ea4098 feat: add interpolatedStr to ParserDescr and Syntax 2020-10-09 14:04:53 -07:00
Leonardo de Moura
1b5bf34e1e chore: update stage0 2020-10-09 13:41:58 -07:00
Leonardo de Moura
36696d726d feat: add String Interpolation 2020-10-09 13:40:35 -07:00
Leonardo de Moura
70ec458fde test: new frontend 2020-10-09 13:20:04 -07:00
Leonardo de Moura
650bd95ab9 feat: add efficient Array.forIn 2020-10-09 13:07:20 -07:00
Leonardo de Moura
7574b9f0ef feat: add coercion Fin => Nat 2020-10-09 12:22:04 -07:00
Leonardo de Moura
0b81ffb569 refactor: factor out nested do term support and document code
We currently use the nested `do` terms for two combinators: `catch`
and `finally`. We may want to support more in the future.
2020-10-09 11:59:14 -07:00
Leonardo de Moura
f6fffc9532 test: monad stack with multiple ExceptT
cc @Kha :)
2020-10-08 19:53:12 -07:00
Leonardo de Moura
8a6cb1842f feat: expand doTry
@Kha I did not implement support for reassignments and `continue`,
`break`, `return` inside the `finally` clause. It is doable, but it
feels like unnecessary complexity. We currently don't have any
instance in our code base where this would be useful.
2020-10-08 19:39:36 -07:00
Leonardo de Moura
0a09706b0b chore: add try, catch, and finally to the list of keywords 2020-10-08 19:39:04 -07:00
Leonardo de Moura
c005a9375a chore: remove workarounds 2020-10-08 16:50:59 -07:00
Leonardo de Moura
9ec583e808 chore: use (doElem| ...) quotation instead of auxDo idiom 2020-10-08 13:54:49 -07:00
Leonardo de Moura
a31595bda5 feat: add doElem.quot elaboration function 2020-10-08 13:50:25 -07:00
Leonardo de Moura
c24cbc2816 chore: update stage0 2020-10-08 13:47:42 -07:00
Leonardo de Moura
7f5af84660 chore: add doElem quotation parser 2020-10-08 13:45:53 -07:00
Leonardo de Moura
a3a5190004 feat: expand doElem macros 2020-10-08 13:42:56 -07:00
Leonardo de Moura
608de7b592 feat: expand doReassignArrow 2020-10-08 13:31:27 -07:00
Leonardo de Moura
c1469643ca chore: cleanup doLetArrowToCode 2020-10-08 13:00:27 -07:00
Leonardo de Moura
3694936b7d test: doHave test 2020-10-08 12:11:07 -07:00
Leonardo de Moura
09dcf718c1 feat: expand doHave 2020-10-08 11:56:03 -07:00
Leonardo de Moura
fe1702070b chore: update stage0 2020-10-08 11:31:36 -07:00
Leonardo de Moura
426f139ea3 chore: remove unnecessary [inline] 2020-10-08 11:29:56 -07:00
Leonardo de Moura
d7ec398b28 test: new do notation 2020-10-07 17:55:38 -07:00
Leonardo de Moura
91aaab9e0d fix: error message location 2020-10-07 17:43:23 -07:00
Leonardo de Moura
d9d8e95987 feat: elaborate doElems at doLetArrow
@Kha The Rust `let+return` example works in Lean too :)
The Rust function
```rust
fn f (x : i32) -> i32 {
    let y = if x == 0 { println!("x is zero"); return 100 } else { x + 1 };
    println!("y: {}", y)
    y
}
```
The Lean version is
```lean
def f (x : Nat) : IO Nat := do
let y ← if x == 0 then IO.println "x is zero"; return 100 else pure (x + 1)
IO.println ("y: " ++ toString y)
return y
```

The main missing feature now is the `try-catch-finally` `do` element.
2020-10-07 17:30:25 -07:00
Leonardo de Moura
ac07999e95 chore: cleanup do expander, and make sure it can handle the "easy" doLetArrows 2020-10-07 17:00:07 -07:00
Leonardo de Moura
1e1962c8f6 chore: update stage0 2020-10-07 16:51:33 -07:00
Leonardo de Moura
5d8764dd92 feat: take doElem at doLetArrow and doReassignArrow 2020-10-07 16:49:28 -07:00