View Single Post
  #34  
Old October 18th, 2004, 11:51 PM
Ed Kolis's Avatar

Ed Kolis Ed Kolis is offline
General
 
Join Date: Apr 2001
Location: Cincinnati, Ohio, USA
Posts: 4,547
Thanks: 1
Thanked 7 Times in 5 Posts
Ed Kolis is on a distinguished road
Default Re: SE4 Templatizer Ready for Download!

Hmmm... looks like the scripting language might have to wait... I just remembered that the on-the-fly code compilation that I was going to use uses something called "reflection", which is VERY slow, and is what was slowing down my program so much in the first place!

I don't suppose throwing together my own interpreter would run code any faster than Microsoft's reflection, would it? Even though I'd be limiting the instruction set, hopefully speeding up the parsing, I don't think I'm that good that I could compete with the likes of them

On the other hand......

The compilation feature of .NET also has the ability to actually compile code into a DLL *on disk*, so maybe what I could do is provide a very basic language that is easy to use, write a compiler for it, which of course would run as quickly as anything I hardcode...

So, what features would you like to be in such a language? Basic math and logical operations are obvious, as are conditional and looping statements (though loops can be created by conditionals and gotos, should I choose to include gotos ) Variable declarations might also help...

Now since we're only going to be defining functions and no fancy data structures in this language, I suppose it might make sense to cut down on the typing and use something similar to Erlang's function definition style, which looks a LOT like the formal mathematical style (forgive my poor syntax; I've never actually written anything in Erlang before )

Recursive algorithm for finding factorials:
Code:

fact(0) -> 1.
fact(1) -> 1.
fact(n) -> if n < 0 error() else n * fact(n - 1).



How does that look? Readable? Maybe I'll get the hang of Erlang after all... then maybe I can even work on writing PLUGINS and stuff for Wings! (Nah, I won't have the time, and besides, I've barely scratched the surface of the language )

(Wow, I never thought I'd be developing my own .NET language, but really, I might be!)

Or maybe I SHOULD start over in Python... I'm already pretty much starting over as it is
__________________
The Ed draws near! What dost thou deaux?
Reply With Quote