style(coder) Feedback from code review
Just adding some comments...
@@ -19,6 +19,20 @@ function coder.generate(filename, input, modname)
return code, errors
end
+
+-- While generating code we set some extra fields in the AST.
+-- In theory we could have stored this info another way, since these fields
+-- don't need to be passed to a following pass.
+--
+-- _global_index:
+-- In Toplevel value nodes (Var and Func).
+-- Describes where in the variable is stored in the upvalue table.
+--
+-- _lua_entry_point
+-- _titan_entry_point
+-- In Toplevel.Func nodes.
+-- Names of the C functions that we generate for each titan function
+
local whole_file_template = [[
/* This file was generated by the Titan compiler. Do not edit by hand */
/* Indentation and formatting courtesy of titan-compiler/pretty.lua */
@@ -893,9 +907,9 @@ generate_exp = function(exp) -- TODO
elseif ltyp == types.T.String and rtyp == types.T.String then
error("not implemented yet")
elseif ltyp == types.T.Integer and rtyp == types.T.Float then
- error("not implemented yet")
+ error("not implemented yet") -- see LTnum
elseif ltyp == types.T.Float and rtyp == types.T.Integer then
- error("not implemented yet")
+ error("not implemented yet") -- see LTnum
else
error("impossible")
end
@@ -908,9 +922,9 @@ generate_exp = function(exp) -- TODO
elseif ltyp == types.T.String and rtyp == types.T.String then
error("not implemented yet")
elseif ltyp == types.T.Integer and rtyp == types.T.Float then
- error("not implemented yet")
+ error("not implemented yet") -- see LTnum
elseif ltyp == types.T.Float and rtyp == types.T.Integer then
- error("not implemented yet")
+ error("not implemented yet") -- see LTnum
else
error("impossible")
end
@@ -923,9 +937,9 @@ generate_exp = function(exp) -- TODO
elseif ltyp == types.T.String and rtyp == types.T.String then
error("not implemented yet")
elseif ltyp == types.T.Integer and rtyp == types.T.Float then
- error("not implemented yet")
+ error("not implemented yet") -- see LTnum
elseif ltyp == types.T.Float and rtyp == types.T.Integer then
- error("not implemented yet")
+ error("not implemented yet") -- see LTnum
else
error("impossible")
end
@@ -938,9 +952,9 @@ generate_exp = function(exp) -- TODO
elseif ltyp == types.T.String and rtyp == types.T.String then
error("not implemented yet")
elseif ltyp == types.T.Integer and rtyp == types.T.Float then
- error("not implemented yet")
+ error("not implemented yet") -- see LTnum
elseif ltyp == types.T.Float and rtyp == types.T.Integer then
- error("not implemented yet")
+ error("not implemented yet") -- see LTnum
else
error("impossible")
end
