@@ -4,6 +4,7 @@ import com.codecommit.gll.LineStream
4
4
import scala .io .Source
5
5
import plus .meow .MeowRust .parser .Parser
6
6
import com .codecommit .gll .Success
7
+ import com .codecommit .gll .Failure
7
8
8
9
/**
9
10
* MeowRust compiler
@@ -14,8 +15,10 @@ import com.codecommit.gll.Success
14
15
* - For example, compare operators requires parentheses to specify associativity
15
16
* - Codegen: Derive(...)
16
17
* - Register: types, impls...
17
- * - Resolve + Type-check - 1: Generate types for each expression. This also involves picking the most accurate trait impl
18
- * - Disugar: Question marks, etc.
18
+ * - Resolve + Type-check - 1: Generate types for each expression.
19
+ * This also involves picking the most accurate trait impl,
20
+ * and actually instantiate generic functions
21
+ * - Disugar: Question marks, etc. Notably, compile matches \w exhaustiveness check
19
22
* - Type-check - 2: Checks if subtyping/conversion works. Insert implicit conversions
20
23
* - Target generation: Dump LLVM IR
21
24
*/
@@ -27,10 +30,16 @@ object Main extends App {
27
30
println(" Processing file " + file)
28
31
val stream = LineStream (Source fromFile file)
29
32
30
- val parsed = Parser .parse(stream)
31
-
32
- if (parsed exists { _.isInstanceOf [Success [String ]] }) {
33
- for (Success (tree, _) <- parsed) { println(tree) }
33
+ // First parse-tree / error is with the intended precedence
34
+ val parsed = Parser .parse(stream).head
35
+ parsed match {
36
+ case Failure (data, _) => {
37
+ print(" Error parsing " + file)
38
+ print(data)
39
+ }
40
+ case Success (tree, _) => {
41
+ print(" Parser tree:\n " + tree)
42
+ }
34
43
}
35
44
}
36
45
}
0 commit comments