Brandon Stewart
June-July 2015

This is a list of changes from Lisa-0.1.0 to Lisa-0.2.0.

********************************************************************
* Overall major changes:
********************************************************************

- namespaces

- making the application data driven. using nxjson to load symbols
in the symbol table, and was useful in removing other hard coded values,
such as those seen in the large switch/if statements.

- multiple backends (note that minigrail's adapter under bin/lib/lisa/ is
not complete.  Once it is, there should be no problems using minigrail.)



********************************************************************
* Specific changes to src files:
********************************************************************




--------------------------------------------------------------------
- Directory: src/nxjson
--------------------------------------------------------------------

- This was added in 0.2.0

- This is a third party library for parsing json.  I do not take credit for writing
it, and all relating details for it can be found in the README in this directory.


- A useful feature is that this parser allows for comments within json.

- The only problem with it is that it will accept invalid json, besides the
comments (details in README).



--------------------------------------------------------------------
- Directory: src/data/symbols
--------------------------------------------------------------------

- All files in this directory will be parsed by nxjson.  This is where new backends can
be added.

- I separated the json so that it's easier for people to read.  Within, for example,
grail.json, there are four sections (namespace, operator, keyword, and function).
In addition, everything in a subsection is in alphabetical order.  I encourage that
this remains like this, so that it's easier to modify.

--------------------------------------------------------------------
- Directory: src/
--------------------------------------------------------------------


abstractsyntaxtree.h:

- *no changes from Lisa-0.1.0 to Lisa-0.2.0.*

abstractsyntaxtree.c:

- *no changes from Lisa-0.1.0 to Lisa-0.2.0.*
- This is an empty file, however.



filereader.h/filereader.c:

- these files are new in 0.2.0

- added because nxjson does not read from files.  This loads an entire file's
contents into a char*.  This char* is then parsed by nxjson to produce the symbol
table.



functions.h:

- This was made obsolete with the addition of JSON, and changes to the "function_icg"
function in icg.c.  It has been removed in Lisa-0.2.0.


functions.c:

- This was made obsolete with the addition of JSON, and changes to the "function_icg"
function in icg.c.  It has been removed in Lisa-0.2.0.


icg.h:

- added declaration "struct Function *namespace_function_icg(int, int, int,struct Parameter_List*);"

- added declaration "void namespace_declaration_icg(int,int,int);"

- added declaration "void using_declaration_icg(int);"



icg.c: ------------------------------------------------------------------------------------

- added "#include "stack.h""

- added "extern Stack* namespaceStack;", which is originally declared in symboltable.h.

- added global "int gen_count = 0;".  This is used in function: "constant_next_icg", to keep track
of the current generator.

- NOTE: this file had several changes from 0.1.0 to 0.2.0.  I'll be going through them
function by function now:

* init_icg:

    - no changes from 0.1.0.

* declaration_icg:

    - removed the hard coded type switch statement, and replaced it with a more
	generic solution.  New types no longer have to be written in this
	function.

* namespace_declaration_icg:

	- new function in 0.2.0, it is the same as declaration_icg, but is only
	called when "namespace::type" syntax is used within Lisa.

* constant_next_icg:

	- removed "unsigned char *name = getHeapObjectName();", and associated code.
	- changed "sprintf(returnvalue,"*(%s=current_gen->next())",name);" to
			  "sprintf(returnvalue,"*(gen%d.next())",gen_count++);".
	This was done to remove the "Generator current_gen" that was defined in
	bin/generated.cc.



* constant_icg:

	- no changes from 0.1.0.

* constant_wrap_function:

	- no changes from 0.1.0.

* constant_wrap_variable:

	- no changes from 0.1.0.

* factor_icg:

	- no changes from 0.1.0.

* factor_wrap_constant:

	- no changes from 0.1.0.

* term_wrap_factor:

	- no changes from 0.1.0.

* term_icg:

	- no changes from 0.1.0.

* addexpression_wrap_term:

	- no changes from 0.1.0.



* addexpression_icg:

	-changed all cases of "string_concat" to "LISASTD::string_concat".  The
	reason string_concat worked on its own before was that
	bin/lib/lisa/lisastd.cc's string_concat function did not have LISASTD:: in
	front of it.  This has been fixed in 0.2.0


* relationexpression_wrap_addexpression:

	- no changes from 0.1.0.

* relationexpression_icg:

	- no changes from 0.1.0.

* unaryrelationexpression_wrap_relationexpression:

	- no changes from 0.1.0.

* unaryrelationexpression:

	- no changes from 0.1.0.

* orexpression_wrap_unaryrelationexpression:

	- no changes from 0.1.0.

* orexpression_icg:

	- no changes from 0.1.0.

* simpleexpression_icg:

	- no changes from 0.1.0.

* simpleexpression_wrap_orexpression:

	- no changes from 0.1.0.

* expression_icg:

	- no changes from 0.1.0.

* expression_wrap_simpleexpression_icg:

	- no changes from 0.1.0.

* variable_icg:

	- no changes from 0.1.0.

* compundstatement_icg:

	- no changes from 0.1.0.

* statements_icg:

	- no changes from 0.1.0.

* whilestatement_icg:

	- no changes from 0.1.0.

* getGeneratorName:

	- no changes from 0.1.0.

* getHeapObjectName:

	- no changes from 0.1.0.
	- this may be removed in a future version, if it is determined to have no use.



* generatingstatement_icg:

	- changed so that "current_gen" is no longer used.
	- put in checks to see which namespace is being used, and whether
	namespace::generator syntax is required.

* namespace_generatingstatement_icg:

	- new function in 0.2.0, it is the same as generatingstatement_icg, but
	is only called when "namespace::generate" syntax is used within Lisa.



* expressionstatement_icg:

	- no changes from 0.1.0.

* ifstatement_icg:

	- no changes from 0.1.0.

* breakstatement_icg:

	- no changes from 0.1.0.

* continuestatement_icg:

	- no changes from 0.1.0.

* parameterlist_icg:

	- no changes from 0.1.0.

* parameterlist_simpleexpression_icg:

	- no changes from 0.1.0.

* parameterlist_type_icg:

	- no changes from 0.1.0.



* function_icg:

	- removed the large if block.  Now, functions are converted to c++ by
	checking namespaces, and other function details, and then writting the
	correct c++ version.  This means that adding new functions will no longer
	mean having to write to the if block, and making a code generating
	function in functions.c/functions.h.


* namespace_function_icg:

	- new function in 0.2.0, it is similar to function_icg, but
	is only called when "namespace::function()" syntax is used within Lisa.



* print_statement:

	- no changes from 0.1.0.

* generate_stringliterals_and_fmpointers:

	- no changes from 0.1.0.



* close_icg:

	- added: "pointer = strstr(code,"$$Namespace$$");
    		  strncpy (pointer,"               ",13);"

	This is to remove the $$Namespace$$ is generated.cc, which was used to put
	"using namespace ...;" near the top of main().


* using_declaration_icg:

	- new function in 0.2.0, it converts "using ...;" in Lisa to
	"using namespace ...;" in c++ (generated.cc).


END OF icg.c
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------


lex.l:

- added a "using" and "::" token.  They are used with namespaces.




makefile:

- new files (filereader, stack, ./nxjson/nxjson) have been added so they can
be compiled


parser.y:

- added "USING" and "NAMESPACE" tokens.  USING is for the using statement, while
NAMESPACE is for the namespace operator "::".


- in grammar "declaraction:" added three new fields:

	| (what I added in yacc)				   --> (what it parses in Lisa)

	|ID NAMESPACE type '[' INTEGER ']' ID ';'  --> grail::dfa[5] myDFA;

	|ID NAMESPACE type ID ';'				   --> grail::dfa myDFA;

	| USING ID ';' 							   --> using grail;


- in grammar "generatingstatement:" added one new field:

	| ID NAMESPACE GENERATE '(' generatortype ',' INTEGER ',' INTEGER ')' statement
		--> grail::generate(random, 4, 2) { }



- in grammar "function:" added one new field:

	| ID NAMESPACE ID '(' parameterlist ')'  --> grail::complete(myDFA);





stack.h/stack.c:

- these files are new in 0.2.0

- this is used to determine the priority of namespaces when two or more "using ..."
statements are used.  The namespace within the last using statement will be at the
top of the stack, and take priority over others.


string.h/string.c:

- no changes from 0.1.0.

- However, this does not appear to have any use.  It should be removed in a
future version.




symboltable.h:

- included two new files:  stack.h, for the namespace stack,
				   nxjson/nxjson.h, for the json parser.


- declared "Stack* namespaceStack;"

- added new value to enum symbol_token_type, "TOKENTYPE_NAMESPACE".  Used to
determine whether a symbol is specifically a namespace identifier.



- added struct "function_data".  This holds how many parameters a function has,
the type that the parameters are (dfa, int, etc), and whether the function
returns a pointer.

	The number/type of parameters are used to find out which function in the symbol
	table to use.

	Lisa does not support pointers (dfa*), so if a function returns a pointer, then the
	data that the pointer points to needs to be given.
	complete(dfa);  (it returns a pointer)--> *(DFA::Complete(dfa));


- typedef struct "symbol_node" has been changed to give it new data.

	It now has:
		- "int namespace_type", which is the symbol table index for the namespace
		that this node is in.

		- "struct function_data param_data", which is the struct discussed above.


- removed function declarations:
		load_functions

- new function declarations:
		namespace_set_variable_type, namespace_set_array_type,
		load_json_with_namespace, load_symbols_from_json,
		count_symbols_same_declaration.
        void delete_symbol_table(void);


symboltable.c: ------------------------------------------------------------------------------------

- two new headers included: #include <dirent.h>, #include <windows.h>

	dirent.h is loaded when compiled on a unix machine, windows.h if it's on windows.


- a new global constant: const char* DATA_SYMBOLS_DIR   = "../src/data/symbols/";

	This is the directory that json files will go to be loaded.


- NOTE: this file had many changes from 0.1.0 to 0.2.0.  I'll be going through them
function by function now, like icg.c:


* init_symbol_table:

	- No longer loads hard coded symbols.  Now, it checks DATA_SYMBOLS_DIR for
	files to parse.  It then passes the file names to a helper function.

	- Depending on whether it was compiled on a unix based machine, or windows,
	this function will be different, due to how files have to be found.


* load_json_with_namespace:

	- This is a new function in 0.2.0

	- This function loads the json file's contents into a char*, which is then
	parsed by nxjson.

	- This function loads the namespace symbol into the symbol table.  This is so
	that everything else loaded from the json file will be within the same namespace.
	If there is no namespace field, then the symbols will end up in the global
	namespace (id = -1).

	- For each other subsection in the json file (operator, keyword, function),
	a json array is passed to another function, "load_symbols_from_json", to load
	in the symbols.

		  This was set up this way so that the json files are more organized, and
		easier for people to read.  This also allows subsections to be added
		and removed easily.

* load_symbols_from_json:

	- This is a new function in 0.2.0

	- This function loads in the symbols passed to it from the nxjson array, and
	adds them to the symbol table.


* load_functions:

	- removed in 0.2.0


* delete_symbol_table:

    - This is a new function in 0.2.0

    - frees the memory used by the symbol table


* add_symbol_node:

	- no changes from 0.1.0.


* find_symbol_node:

	- now checks for TOKENTYPE_PREDEFINED_FUNCTION, and TOKENTYPE_KEYWORD, in
	addition to what it used to.  This change allows for multiple functions/keywords
 	with the same name, but with differing parameters/namespaces to be added.


* expand_symbol_table:

	- no changes from 0.1.0.


* print_symbol_table:

	- added addition fields for namespace, and returns pointer


* add_id_symbol_node:

	- initialized new parameters (param_data)


* add_stringliterals_symbol_node:

	- added "node->namespace_type = -1;", because string literals are in global
	namespace.
	- initialized new parameters (param_data)


* add_character_symbol_node:

	- initialized new parameters (param_data)


* set_variable_type:

	- changed to support namespaces, and considering the namespace stack.


* namespace_set_variable_type:

	- new function in 0.2.0, it is similar to set_variable_type, but
	is only called when "namespace::variable" syntax is used within Lisa.


* set_array_type:

	- changed to support namespaces, and considering the namespace stack.


* namespace_set_array_type:

	- new function in 0.2.0, it is similar to set_array_type, but
	is only called when "namespace::variable[#]" syntax is used within Lisa.


* add_number_symbol_node:

	- added "node->namespace_type = -1;" because numbers are in the global
	namespace.


* add_finitemachine_pointer_symbol_node:

	- no changes from 0.1.0.



* count_symbols_same_declaration:

	- This is a new function in 0.2.0

	- Counts the number of symbols with similar declaration in different namespaces.

		  example: Altogether, there are four "concat()" functions in the symbol
		table.  Two are in grail, the others are in minigrail.  The specific concats
		are for dfa's or nfa's.  When a grail concat that takes nfa's as parameters
		is passed to this function, it will return 1.  This is because minigrail
		also has a concat function that takes node type nfa.

			This is used when two or more namespaces are being used in "using ..."
		statements.  It will determine whether the namespace::concat syntax will
		be needed.


END OF symboltable.c
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------








-----------------------------------------------------------------------------
