==================================================================================
Change Makefile "clean" so that it does not remove slang1.  ---tgg22
==================================================================================
From:	Leonhard Markert 
Date:	Thu, 17 Jan 2013 20:59:38 +0000
Subject:	"Usage" message printed twice

Dear Dr Griffin,

I think I've found a tiny bug in slang1's main.sml: The version of the
"slang1" program on the website prints the usage message twice when
executed without arguments. This is because "process_args" prints the
usage string if there is no input file, but main prints it as well in
case process_args fails.

This can be fixed by removing "print usage ;" from either of the two
places. I think that it is cleaner for the process_args function to just
return false when the input file is not specified; the according patch
would be:

--- a/slang1/main.sml
+++ b/slang1/main.sml
@@ -55,7 +55,7 @@ fun process_args args =
      let val _ = scan_args args
      in
          if !fin = ""
-        then (print usage; false)
+        then false
          else if !fout = ""
               then infile_to_outfile (!fin)
               else true
==================================================================================
From:	Leonhard Markert 
Date:	Fri, 18 Jan 2013 23:36:34 +0000
Subject:	"type_check.sml" -> "static_semantics.sml" [was Re: "Usage" message printed twice]

Just found another small thing: In the Slang1 README, the non-existent
file "type_check.sml" is mentioned. The description seems to match what
"static_semantics.sml" is doing, and "static_semantics.sml" is not in
the README. Assuming that somewhere in the development of the compiler,
"type_check.sml" was renamed "static_semantics.sml", I propose the
following fix:

--- a/slang1/README.txt
+++ b/slang1/README.txt
@@ -26,7 +26,7 @@ AST_vsm_bytecode.sm   : AST for VSM.0 byte code
  Lexer.sml            : hand-written lexer
  parser.sml           : slang.1 -> expr, hand-written recursive-descent
parser
                        : (see file for a slang.1 grammar description)
-type_check.sml        : expr -> expr annotation with types
+static_semantics.sml  : expr -> expr annotation with types

  normalise.sml         : expr -> normal_expr, giving "names" to each
sub-expression
  vrm_code_gen.sml      : normal_exppr -> vrm_assembler, code generation

==================================================================================
From:	Ian Orton
Date:	Fri, 25 Jan 2013 16:44:19 +0000
Subject:	Slang 1 lexer

I was playing around with the slang compiler and noticed that it
wouldn't properly lex true and false literals when I tried to compile
"if true then print(1) else print(0)".

My proposed fix is to simply add the relevant clauses to str_to_token i.e. :

     | "true"    => Ttrue
     | "false"    => Tfalse

==================================================================================
From:	Leonhard Markert 
Date:	Sun, 27 Jan 2013 19:06:25 +0000
Subject: VSM If code generation 

Just found this one while trying to test my short-circuit operator
implementation on the VSM:

The expr_to_vsm_code_list function in vsm_code_gen.sml drops the
condition code when converting an If..then..else expression to VSM code!
The expression e0 in If(e0,e1,e2) is converted to a VSM code list cl0,
but cl0 is not part of the code that the function returns.

Fix: Include cl0. I've changed some of the comments, too, but the actual
difference is that now cl0 is included.

---
 slang1/vsm_code_gen.sml |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/slang1/vsm_code_gen.sml b/slang1/vsm_code_gen.sml
index 73df49c..654ea4d 100644
--- a/slang1/vsm_code_gen.sml
+++ b/slang1/vsm_code_gen.sml
@@ -144,11 +144,12 @@ fun expr_to_vsm_code_list env Skip            =
         let val (l2, cl3) = vsm_label_sequence cl2
             and l3 = new_label()
         in
-           (env2, VSM_Code(VSM_Ifz (l2, " start if ..."))
-                  :: (cl1
-                      @ [VSM_Code(VSM_Jmp (l3, " ... end then ..."))]
-                      @ (vsm_insert_remark " start else ... " cl3 )
-                      @ [VSM_Labelled(l3, VSM_Nop "... end if")]))
+           (env2, (vsm_insert_remark "start if (condition) ... " cl0)
+                  @ [VSM_Code(VSM_Ifz (l2, "test of if ..."))]
+                  @ (vsm_insert_remark "start then ... " cl1 )
+                  @ [VSM_Code(VSM_Jmp (l3, "... end then ..."))]
+                  @ (vsm_insert_remark "start else ... " cl3 )
+                  @ [VSM_Labelled(l3, VSM_Nop "... end if")])
         end
     end
   | expr_to_vsm_code_list env (While(e1, e2))     =
--
1.7.10.4

==================================================================================



