Skip to content

Commit

Permalink
add "with" to tokens. clean up match syntax. think about apply.
Browse files Browse the repository at this point in the history
  • Loading branch information
oconnor0 committed Mar 26, 2012
1 parent bfb8f8a commit 95eca3b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
@@ -1,8 +1,11 @@
/* (C) 2012 Matt O'Connor <thegreendragon@gmail.com> */
package zero.compiler.parser;

public class Precedence {
public final class Precedence {
public static final int VAL = 0;
public static final int PLUS = 3;
public static final int TIMES = 4;
public static final int APPLY = 9;

private Precedence() {}
}
2 changes: 2 additions & 0 deletions zero-compiler/src/main/java/zero/compiler/parser/Token.java
Expand Up @@ -16,6 +16,7 @@ public enum Type {
ELSE,
END,
MATCH,
WITH,
TYPE,
EQUALS,
PLUS,
Expand Down Expand Up @@ -47,6 +48,7 @@ public static Type fromString(final String s) {
case "end": return END;
case "type": return TYPE;
case "match": return MATCH;
case "with": return WITH;
case "=": return EQUALS;
case "+": return PLUS;
case "-": return MINUS;
Expand Down
3 changes: 1 addition & 2 deletions zero-compiler/src/test/zero/fib.z
Expand Up @@ -9,6 +9,5 @@ val fib = fn n ->
match n with
| 0 -> 0
| 1 -> 1
| _ ->
else fib (n-1) + fib (n-2)
end
end

0 comments on commit 95eca3b

Please sign in to comment.