• Welcome to Battlezone Universe.
 

News:

Welcome to the BZU Archive dated December 24, 2009. Topics and posts are in read-only mode. Those with accounts will be able to login and browse anything the account had access granted to at the time. No changes to permissions will be made to be given access to particular content. If you have any questions, please reach out to squirrelof09/Rapazzini.

Main Menu

Made up language?

Started by OvermindDL1, March 12, 2008, 01:03:24 AM

Previous topic - Next topic

OvermindDL1

I did not know quite where to put this since the programming board is gone, but as this may relate to BZ2, here should be good.
I created the basics of a little new language earlier today, was wanting a scripting language but of a certain feature set (and I was itchy to use a new optimization engine I ran across), so I implemented enough of it to write the Fibonacci program recursively (you know, the freakishly long time consuming method.  I wrote the parser in boost::spirit (think ebnf grammer, but in C++ form) and stuffed the thing into the optimizer and run it.  I came up with some interesting times, when just executing through the AST it was slower then all heck (even non-jit'ed python in its slow numbers glory eclipsed it in speed, and I could speed up the AST execution speed if I wished, I just had a ton of checks and so forth in them, you know, good for AST building, not execution), however, when ran through the optimizer it ran faster then all the other tested versions, being lua, python, and python-psyco (jit'ed python, should execute numbers based programs at near C speed).

Yes, ran faster then jit'ed python.  Did some very high calculations (up to 45) and it still did them freakishly fast, too fast I thought, so I wrote a real C program, compiled in both 2k5 and 2k3 at high speed optimizations, and my version ran through that optimizer library still exceeded the C programs (just barely, but that 'barely' become a 7 second lead when doing fib(45), 11.8 compared to 18.8 seconds).  Needless to say, I love this optimizer, going to put it through its paces when I get more time later on, probably something mission based for BZ2 (it is trivial to link in my own functions, or rather import functions from BZ2, especially since they all use the C calling convention, and by trivial I mean the optimizer will auto-link by default to all exported functions in the current process that are C extern'ed, I just need to match the parameters and return value) as that is what I know very well.  There is a C compiler being made for this library (C++ to come later) and it has been shown to be faster then even gcc, which nowadays is the fastest.  It is almost too easy to make a language on top of this, thus rather hard to resist. :)

But yea, all the tests I did are documented over at:  http://forum.orderlymayhem.com/index.php/topic,219.msg2566.html#msg2566

Generated by OvermindDL1's Signature Auto-Add Script via GreaseMonkey


Nielk1

This will sound a bit dumb at first.
I want a language that has the abilities of C++, the dynamic casting and easy use of pointers (cause C++ pointers are hell) of Java, the straight English style of Visual Basic (specifically the ByVal and ByRef lines that can go in the function parameters), and maybe the ability to make server applications like Visual Fox Pro (I just started learning this).

On the actuly subject of the topic:
"OOOO, another language!"
I will look at it.

Click on the image...

Avatar

OM talking to Avatar:

Hey Avatar blah blah blah Avatar blah blah blah language blah blah blah new blah blah blah...

Like Bart talking to the dog in the Simpsons, this is not meant as a dig at OM, it's meant to garner sympathy for poor little Avatar's brain...  which is sizzling after reading that.  :)

Let me translate it for my numbed brain cells:

"Ugh. Avatar listen.  OM got new toy.  Toy very fast.  OM happy."

"Avatar smash puny human..."

-Av-

:-D

(that last line is a HULK reference, you know...)

OvermindDL1

#3
Nielk1:
I've heard of FoxPro, but never used it and have no clue what it does (and considering it disappeared in later visual studios, never had any inclination to), so, details? :)

Do note, hiding pointers in a java/python style removes so much of the vast options that C++ has, so you will not get 'the best of both worlds' in that case. :)  And no, pointers are not hell, I find them quite wonderful to work with, that is my biggest beef that is missing in Java, takes so much more code to do stuff without proper pointers.

And ByVal in something like C would just be something like "void myFunc(int a)" and ByRef is something like "void myFunc(int &a)", so even shorter and easier to read (in my opinion anyway). :)

The thing I want the most in a C++ type language is something that is coroutinish (true coroutines are slow, and there are limited forms you can do that are about as powerful, but with very little if any speed hit).

Avatar:
Basically, I was pretty blown away with the speed, I did not expect a little code snippet to be faster when it is lexed, parsed, compiled, optimized, linked, and executed, to be faster then a C app that just runs the executed part.  I still do not know how it is faster, the problem can not be efficiently tail recursed with how it was made, it cannot really be optimized away, and dumping out the intermediate bytecode after optimizations shows nothing that I can see that makes it faster then the C version, it just is... :P

And I did have others run the demo apps (the in-built scripted version and the c version) and the speed tests seem consistent on different computers, if anyone else wants it then just ask.

Generated by OvermindDL1's Signature Auto-Add Script via GreaseMonkey


Nielk1

Quote from: OvermindDL1 on March 12, 2008, 06:24:18 PM
Do note, hiding pointers in a java/python style removes so much of the vast options that C++ has, so you will not get 'the best of both worlds' in that case. :)  And no, pointers are not hell, I find them quite wonderful to work with, that is my biggest beef that is missing in Java, takes so much more code to do stuff without proper pointers.

I found that what I've learned of pointers so far could be done in JAVA without issue. I haven't learned mutch yet.
I don't have teh best examples for pointers, so it kinda makes me HATE THEM.

As for Visual Fox Pro, it continued to develop, but it is in its own program and I still have alot to learn about it.

I ahve to learn Ruby and Lua too...

Click on the image...

OvermindDL1

#5
I've found so many things in java that require me to increase the code count by a factor of ten sometimes due to lack of proper pointers.  Heck, just doing something this simple:
// C code
int arr[64];
populateArray(arr);
int *end = arr+sizeof(arr);
for(int *i = arr;i<=end;++i)
{
    // doSomething with (*i)
}

// Or in my normal C++ code I would do:
foreach(int &i, arr)
{
    // doSomething with i
}


// Heck, just try doing something simple like this in Java:
int j = 3, k = 4;
CallSomeFunc(&j);
// j is now 5, and k is now 7


void CallSomeFunc(int *someNum1, int *someNum2)
{
    someNum1 = 5;
    someNum2 = 8;
}

//Although another way of doing that in C++ (again, try doing it this simple in Java)
int j = 3, k = 4;
tie(j, k) = CallSomeFunc(&j);
// j is now 5, and k is now 7
// You could of course just hold the tuple itself in a variable and access the parts of it as you wish...

tuple<int, int> CallSomeFunc()
{
   return make_tuple(5, 7);
}

// Another very useful time:
int Array[3];
Array[0] = 10;
Array[1] = 20;
Array[2] = 30;

int *pArray;
pArray = &Array[0];

printf("pArray points to the value %d\n", *(pArray++));
printf("pArray points to the value %d\n", *(pArray++));
printf("pArray points to the value %d\n", *(pArray++));

/* Would print this:
pArray points to the value 10
pArray points to the value 20
pArray points to the value 30
*/


There are tons of other times I've come across dearly wanting them in Java, but I generally only remember when I come across them.  Usually doing matrix heavy math in Java I would near kill for them (doing things like that make me really hate Java).

Generated by OvermindDL1's Signature Auto-Add Script via GreaseMonkey


Nielk1

It just seems to me that on occasion I was working with a pointer in Java and didn't even notice until after I went over my code.
I had no knowledge of what a pointer was at the time, so rather this is me looking back while started to mess with pointers in C++.

Hey! Ya wanna make some sort of code Rosetta Stone?

Click on the image...

OvermindDL1

I think the library I am using is already that. :)

Generated by OvermindDL1's Signature Auto-Add Script via GreaseMonkey