Commits

Anonymous committed bfc758e

Change how errors are displayed; some tests actually pass now.

  • Participants
  • Parent commits 693c0cc

Comments (0)

Files changed (2)

File README.markdown

     | cons(HI, THERE)
     = (HI THERE)
     
-    | (cons(HI, cons(THERE, NIL)))
+    | cons(HI, cons(THERE, NIL))
     = (HI (THERE NIL))
 
     | <head cons(HI, THERE)
 
     | def snoc(#, another)
     |     cons(another, #)
-    | snoc(THERE HI)
+    | snoc(THERE, HI)
     = (HI THERE)
 
     | def count(#)
 
     | def last(#)
     |     if not(cons?(#)) then # else self(<tail #)
-    | last(cons(A cons(B GRAAAP)))
+    | last(cons(A, cons(B, GRAAAP)))
     = GRAAAP
 
     | def count(#, acc)
     | def urff(#, boof)
     |     self(<tail boof)
     | urff(GRAAAAP, SKOOOORP)
-    ? Expected <smallerterm>, found "boof"
+    ? Expected <smaller>, found "boof"
 
     | def urff(#)
     |     self(WANGA)

File script/exanoke

             e3 = self.smallerterm()
             return AST('If', [e1, e2, e3])
         else:
-            raise SyntaxError('Unrecognized term "%s"' % self.scanner.token)
+            raise SyntaxError('Expected <smaller>, found "%s"' %
+                              self.scanner.token)
 
     def smallerterm(self):
         if self.scanner.consume("#"):
     text = file.read()
     file.close()
     p = Parser(text)
-    prog = p.program()
+    try:
+        prog = p.program()
+    except SyntaxError as e:
+        print >>sys.stderr, str(e)
+        sys.exit(1)
     if options.show_ast:
         from pprint import pprint
         pprint(prog)