From 3f7b2af82ffcb78df77ec64342ad2ca13c81f683 Mon Sep 17 00:00:00 2001 From: nisstyre56 Date: Sat, 26 Apr 2014 20:18:47 -0400 Subject: [PATCH] -> should be in the list of operators --- closure_conversion.js | 3 +-- parse.js | 5 +++-- representation.js | 8 +++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/closure_conversion.js b/closure_conversion.js index 6908051..c4e72fb 100644 --- a/closure_conversion.js +++ b/closure_conversion.js @@ -151,8 +151,7 @@ function test(src) { console.log(JSON.stringify(closure_convert_all(ast), null, 4)); } -//console.log(test(pprint.pprint(parser.parse(pprint.pprint(parser.parse("if something then if a then if b then c else d else rtrrt else some_other_thing")[0]))[0]))); -console.log(pprint.pprint(parser.parse("(34 :: A)")[0])); +//console.log(test("if something then if a then if b then c else d else rtrrt else some_other_thing")); module.export = { test : test, closureConvert : closure_convert_all diff --git a/parse.js b/parse.js index 761f886..c1f299e 100755 --- a/parse.js +++ b/parse.js @@ -458,6 +458,7 @@ function parseLambda(tokens) { tokens, charnum, linenum); + console.log(tokens); if (fst(tokens)[1] !== "->") { throw error.JSyntaxError(fst(tokens)[3], fst(tokens)[2], @@ -639,5 +640,5 @@ module.exports = { parse : function(str) { }, tokenize : tokenizer.tokenize }; -//var istr = fs.readFileSync('/dev/stdin').toString(); -//console.log(parseFull(tokenizer.tokenize(istr)).map(pprint.pprint)); +var istr = fs.readFileSync('/dev/stdin').toString(); +console.log(parseFull(tokenizer.tokenize(istr)).map(pprint.pprint)); diff --git a/representation.js b/representation.js index af27a24..efb34f9 100644 --- a/representation.js +++ b/representation.js @@ -196,6 +196,11 @@ function TypeApp(expression, type) { "Left-hand-side of type application must not be in the type language" ); } + if (!type.prototype.isTypeExpr) { + throw errors.JInternalError( + "Right-hand-side of type application must be a type expression" + ); + } this.expr = expression; this.type = type; this.exprType = "TypeApplication"; @@ -247,7 +252,8 @@ OPInfo = {"+" : [3, "Left"], ">>=" : [1, "Left"], "<$>" : [1, "Left"], "." : [1, "Left"], - "," : [1, "Left"]}; + "," : [1, "Left"], + "->" : [1, "Right"]}; module.exports = {