Thu Feb 15 12:01:35 GMT 2007
i'm using a hash table to store 'core' macros: those that are
fixed. however, a forth program can create macros, so these need to be
maybe make that a bit more strict?
the same goes for constants.. i'm using fixed machine constants in a
hash table, and some user defined stuff in other places.
this needs some serious thinking..
constants can be implemented as macros which inline literals. so the
only remaining question is: how to handle macros?
macros are really compiler extensions. they are a property of the
host, not of the target code.
it would be really inconvenient having to split a project into two
parts, so i should aim for macro defs inside source files. however, a
clear distinction needs to be made between host and target things:
target properties are related to on-chip storage == addresses
host properties are related to code generation only
the result is that there are 2 possible actions on a source file:
- reload macros + constants
- recompile = realloc code and data
to track the state of a project, the only thing that needs to be saved
is the source code + a dictionary of target addresses. all the rest
(macros) can be obtained directly from the source code.
actually, this is a lot better than the old approach, where macros are
stored in a project state file.