Yeah I thought about Notepad++ but I figured, its something Im just doing in my spare time on the train ride in / from college, and writing my own compiler would allow for pretty much any feature anyone wanted.
I’ve been planning out how the syntax highlighting will work (Ive never written a compiler before :P) and I’ve figured out how everything needs to be done. If anyone is interested here are my thoughts:
Ill create a set of string tables (a string table is essentially just a list of words that can be looked up). Each string table will be stored in a text file (so it can be modified later on if new functions come out), and represent one kind of phrase. For example one string table will contain all of the available commands, another will contain any operators, etc.
I would then need to find the last word the user wrote, and search within all of the string tables to determine if this word / phrase belongs to any string tables, and if so highlight it the appropriate colour. Obviously this would take a while to calculate with all of the possible phrases one could write. So I plan on having the system continuously filter out impossible phrases as the user enters each letter. Because the string tables will be ordered alphabetically, if the user (for example) presses the a key first, I can ignore all phrases that dont start with a. This would continue on down the line as the user enters more and more letters. When the user finally finishes the word, there will logically only be one string left that matches what they’ve written.
Another benefit of constantly filtering unneeded phrases as the user types is the ability for auto-completion. All Ill have to do is check when there are - for example - under 5 possible phrases left to search for, and display them in a dropdown box that the user can select from to auto-complete their phrase for them.
The compiling process will be a little more difficult as I haven’t worked with ZScripts much, however Im sure with my background in programming / looking over the user reference Ill be able to come up with at least a basic set of rules that can further be defined later on.
Anyways, Ill work some more on this on the train ride in tomorrow and hopefully have the beginnings of the syntax highlighting system in place.