summaryrefslogtreecommitdiff
path: root/src/lexer2.mll
diff options
context:
space:
mode:
authorAlasdair Armstrong2017-11-30 19:35:35 +0000
committerAlasdair Armstrong2017-11-30 19:35:35 +0000
commitdd00feacb373defbcfd8c50b9a8381c4a7db7cba (patch)
treeb630009d3d14d593a06cf59f87839ee6869c0f6e /src/lexer2.mll
parent16c475fff5b1942eacc4f399ff14a0bca0c9cec2 (diff)
Improvements to enable parsing and checking intermediate rewriting
steps Parser now has syntax for mutual recusion blocks mutual { ... fundefs ... } which is used for parsing and pretty printing DEF_internal_mutrec. It's stripped away by the initial_check, so the typechecker never sees DEF_internal_mutrec. Maybe this could change, as forcing mutual recursion to be explicit would probably be a good thing. Added record syntax to the new parser New option -dmagic_hash is similar to GHC's -XMagicHash in that it allows for identifiers to contain the special hash character, which is used to introduce new autogenerated variables in a way that doesn't clash with existing names. Option -sil compiles sail down to the intermediate language defined in sil.ott (not complete yet).
Diffstat (limited to 'src/lexer2.mll')
-rw-r--r--src/lexer2.mll6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lexer2.mll b/src/lexer2.mll
index 40e7eec6..a8dbaaf3 100644
--- a/src/lexer2.mll
+++ b/src/lexer2.mll
@@ -121,6 +121,7 @@ let kw_table =
("in", (fun x -> In));
("inc", (fun _ -> Inc));
("let", (fun x -> Let_));
+ ("record", (fun _ -> Record));
("Int", (fun x -> Int));
("Order", (fun x -> Order));
("pure", (fun x -> Pure));
@@ -142,6 +143,7 @@ let kw_table =
("until", (fun _ -> Until));
("while", (fun _ -> While));
("do", (fun _ -> Do));
+ ("mutual", (fun _ -> Mutual));
("barr", (fun x -> Barr));
("depend", (fun x -> Depend));
@@ -169,7 +171,7 @@ let binarydigit = ['0'-'1']
let hexdigit = ['0'-'9''A'-'F''a'-'f']
let alphanum = letter|digit
let startident = letter|'_'
-let ident = alphanum|['_''\'']
+let ident = alphanum|['_''\'''#']
let tyvar_start = '\''
let oper_char = ['!''$''%''&''*''+''-''.''/'':''<''=''>''@''^''|']
let operator = (oper_char+ ('_' ident)?)
@@ -200,6 +202,8 @@ rule token = parse
| ";" { Semi }
| "*" { (Star(r"*")) }
| "_" { Under }
+ | "[|" { LsquareBar }
+ | "|]" { RsquareBar }
| "{|" { LcurlyBar }
| "|}" { RcurlyBar }
| "|" { Bar }