Well, I've decided to start over on the interpreter and instructions classes because in all honesty - that's far too vile a gust for me to stand... the codesmells are absolutely gnarly, dude.
Alright. I'm finally ready to put the Vilegust Parser class I wrote a few days ago to good use.
What better use than to take the control flow graphs generated by the parser and the instructions that I generated and add executable instructions to them?
But first... lets consider how to implement the interpreter, because there are several approaches I've been introduced to:
- My own idea is to just go through the list of instructions revealed by the parser and execute everything - starting with instruction 1 and ending with instruction n.
- Another idea is to create a stack frame... where the instructions all modify a stack frame and the stack frame points to the next instruction.... read more
With all of my previous efforts... my languages were isolated from other languages. Not so with dynamic invocation. I can call a method in a dynamically linked library with the new class I've spliced together from the MSDN, DynamicInvoke.
It took me a few days to find the answers I was looking for and to ask the questions I needed to answer... but I finally found what I needed. Thanks go to the knowledgeable people at StackOverflow.... read more
I cannot tell what kind of constructs these are... control or organizational constructs?
Anyway, I think the implementation should be simple enough... look at the latest Vilegust Context Free Grammar (0.4) and at the lines that cover the creation of subs and functions... the only difference is that one is void (has no return type) while the other has a return type of string, integer or Boolean.
The let command isn't too complex but the data table behind it and how that table is associated with the symbol table... seems confusing right now.
Let's see - how should the program:
Dim AString as String
Let AString = "Test"
Well, Dim already works by entering the symbol AString into the symbol table with the type StringSymbol.
The next step is to create a data gathering symbol association class. What should that look like?... read more
As I see it... one way to begin creating everything vilegust needs is to have it passing data out to library (specifically dlls) functions.
Such a program would call on a dll and (viola!) you have working executable structures:
Declare Sub CreateConsoleOutputA Using "user32.dll" (OutputText as String)
Call CreateConsoleOutputA ("hello world!")
If such a program fails to be compilable... well, I guess I have to come up with new goals.... read more
I don't know if it's a good approach but I think I will start with Dim and Declare... thataway I know for sure what variables are what in the symbol table.
The symbol table will look like this:
End Enum... read more
If you'll take a look in the Wiki... at Grammar zero... I've got a little bit of a parser to build.