Commit graph

6 commits

Author SHA1 Message Date
Joseph Kogut
ca87b3c5e9 Refactor with a consistent coding style
This commit refactors the project using a single, consistent coding
style, derived from the Linux Kernel Coding Style, available here:

https://www.kernel.org/doc/Documentation/CodingStyle

This includes, but is not limited to:
* Removal of typedefs, especially for structs
* Limiting lines to a reasonable length, 80 characters, mostly
* K&R style braces
* Removal of CamelCase
2016-08-28 20:31:12 -07:00
Payton Turnage
e99a0428f3 Implement defines using the htab structure.
The htab_structure has been modified in two ways, which should not break
compatability with any of its uses.

It includes a void pointer, which is in this commit used to point to a
string for defines, and will in the future be used to point to the address
space for words, bytes, and double words.

It now includes a function htab_add_str specifically for storing strings.
It calls htab_add so as not to be redundant, but makes the node's value
their index for the lexer to fetch using htab_find, and assigns their
void pointer.

The lexer will now use htab_find on all tokens to see if they are a define
string, and if so, substitute them with the appropriate token.

The defines htab is destroyed after lexing, because that memory is done.
2014-01-13 10:20:21 -05:00
Payton Turnage
ed12ce05db Remove all traces of the tvm_tree structure.
It is to be replaced with a htab hash table.
2014-01-13 09:45:27 -05:00
Payton Turnage
c80d6974cb Substitute defines with their strings.
Before allocating space for a token, the lexer will first check to see
if that token is a defined name. If it is, it will allocate space for
the defined string instead.

A test file is included in programs/tinyvm/preprocessor to demonstrate
the behavior. When functioning, the program will print the fibonacci
sequence.
2014-01-12 21:43:57 -05:00
Joseph Kogut
d270cc5706 Made pointer syntax consistent 2013-01-23 11:06:19 -07:00
Joseph Kogut
15019d041f * Moved TVM code to an independent library
* Moved interpreter code to tvmi.c
2011-08-26 15:30:24 -07:00
Renamed from tvm_lexer.h (Browse further)