View previous topic :: View next topic |
Author |
Message |
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Tue Aug 15, 2006 11:20 am Post subject: August 14th/15th - IT WORKS!!! |
|
|
OH sweet, yes, it works!
Yesterday (14th) wasn't ver productive, mostly because I was mulling over how calling and returning worked, and also because of my damned social life but I finished Call and Ret today, and got their support functions done, and..
Code: | void main()
{
MDGlobalState.initialize();
MDState state = MDGlobalState().mainThread();
MDClosure closure = new MDClosure(state, compileFile(`simple.md`));
int mdwritefln(MDState s)
{
int numParams = s.getBasedStackIndex();
for(int i = 0; i < numParams; i++)
writef(s.getBasedStack(i).toString());
writefln();
return 0;
}
MDClosure writeflnClosure = new MDClosure(state, &mdwritefln);
state.setGlobal("writefln", writeflnClosure);
state.call(state.push(closure), 0, 0);
} |
plus:
Code: | local function foo()
{
writefln("hi ", 4, ", ", 5);
}
foo(); |
equals:
!!!
It works. |
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Tue Aug 15, 2006 11:25 am Post subject: |
|
|
Congrats! Don't you just love it when a concept comes together?
I've been lurking here and I've gotta say: this project is quite interesting.
But have you considered side-stepping the VM completely and go straight for X86 code generation instead? _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Tue Aug 15, 2006 1:55 pm Post subject: |
|
|
That would be awesome, but there are a few issues with it. If I were to make the compiler directly generate machine code.. not only do I not know nearly enough about x86 architecture to write a compiler for it, but it'd also be tying the compiler to one platform. The other option is to have the compiler generate bytecode as it does now, and then run a JIT pass on it using something like libjit, which would basically convert the bytecodes to the native code equivalents. That might produce pretty bloated code (though still faster than interpreted), and porting it to another platform would involve recompiling libjit for the target platform as well - which means that someone has to have made a libjit port, since each port depends upon the platform it's being compiled on!
So for now, at least, or maybe until I take the "compiler design" course in my third year at college MiniD will be just interpreted. |
|
Back to top |
|
|
Gregor
Joined: 05 May 2006 Posts: 72 Location: Portland, OR
|
Posted: Tue Aug 15, 2006 5:59 pm Post subject: |
|
|
Seems to me like the primary "missing piece" remaining is a robust standard library, no? |
|
Back to top |
|
|
JJR
Joined: 22 Feb 2004 Posts: 1104
|
Posted: Tue Aug 15, 2006 6:30 pm Post subject: |
|
|
Jarrett,
I'm happy for your success.
Just want you to know, though, that I find your use of profanity as offensive here as on the newsgroup. I took the liberty of editing out your use of it. Please don't do that in the future. Thanks.
-JJR |
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Tue Aug 15, 2006 7:43 pm Post subject: |
|
|
Quote: | Seems to me like the primary "missing piece" remaining is a robust standard library, no? |
Pretty much, yes. The interpreter isn't quite done (still working out bugs and have the exception handling mechanism to implement), and the API needs to be fleshed out, but I'm already starting to think about what needs to be in the standard library. Once the interpreter and API are solidified, real work on the stdlib can begin.
Quote: | Just want you to know, though, that I find your use of profanity as offensive here as on the newsgroup. |
Sorry. |
|
Back to top |
|
|
Derek Parnell
Joined: 22 Apr 2004 Posts: 408 Location: Melbourne, Australia
|
Posted: Tue Aug 15, 2006 7:57 pm Post subject: |
|
|
JarrettBillingsley wrote: |
Quote: | Just want you to know, though, that I find your use of profanity as offensive here as on the newsgroup. |
Sorry. |
Did I miss something? What profanity?
BTW, MiniD sounds like a fun project. Glad to see you're enjoying it. _________________ --
Derek
skype name: derek.j.parnell |
|
Back to top |
|
|
Gregor
Joined: 05 May 2006 Posts: 72 Location: Portland, OR
|
Posted: Tue Aug 15, 2006 8:45 pm Post subject: |
|
|
JarrettBillingsley wrote: | Quote: | Seems to me like the primary "missing piece" remaining is a robust standard library, no? |
Pretty much, yes. The interpreter isn't quite done (still working out bugs and have the exception handling mechanism to implement), and the API needs to be fleshed out, but I'm already starting to think about what needs to be in the standard library. Once the interpreter and API are solidified, real work on the stdlib can begin.
Quote: | Just want you to know, though, that I find your use of profanity as offensive here as on the newsgroup. |
Sorry. |
Dibs on CGI |
|
Back to top |
|
|
JJR
Joined: 22 Feb 2004 Posts: 1104
|
Posted: Tue Aug 15, 2006 9:01 pm Post subject: |
|
|
Derek Parnell wrote: | Did I miss something? What profanity? |
I edited it out.
Derek Parnell wrote: | BTW, MiniD sounds like a fun project. Glad to see you're enjoying it. |
I agree.
-JJR |
|
Back to top |
|
|
|