I'm looking for ways to convert textual symbols/identifiers into a small integer e.g. 16-bit short int. The key things are for the amount of RAM used to be small, lookup to be reasonably quick and for back convertion from the integer to string to be possible. The table needs to be created incrementally such that the integers coresponding to a given identifier doesn't change when new identifier is added. The target system (LPC) has a lot more Flash than RAM so I already have a table of common and system identifiers in Flash. Of course, for that I have the entire list in advance so I can sort and index it for speed, and space is less of an issue.
The aim is to produce a small scripting engine for driving my hardware. There is already a command system but it's not powerful enough for the future (or even for now). The simplest solution is a long list of strings with new ones appended. Searching is then linear and the return value could be the position of the found string from the start or somtheing like that.
Thanks for any hints...
Peter