Operation: catsmeow
Displaying 1-20 of 26 total.
12 next
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Jesse

Hey All,

So, I started a crazy project a week ago to create a new front end for the verge compiler. (That the part that parses the VC and makes something out of it, in this case, a parse tree.) Well, I've got to the point that it's working for almost everything (just a couple operators to add in) and it's producing equivalent Lua code. (There's still a lot of type- and consistency-checking to be added in.) The original intent was to replace the verge core with Lua's runtime and so run the VC that way. This would make it real easy to add cool new features because we could easily add anything we could write in Lua. Lua, of course, supports calls into and from C++ code.

Weeelll, it turns out that Lua's not an especially good choice. It supports ints, but can't support floats at the same time, so that avenue is nixed. It also has different rules about truth and falseness that don't correspond well to verge's. And the built-in arrays are all implemented as string-keyed hashes, and so would probably be slow/memory intensive for large arrays. Something like python might be a better match.

So, my question is, to those that care about verge internals: now that I have the start of a new compiler, what might we do with it? Target it to produce current verge opcodes? Target it to produce python and replace the verge core with that? Create a new VM and target that? Throw the new front end away? Any thoughts?

The front-end is written using Flex/Bison (like lex/yacc) and treecc for the resulting parse tree and operations. It's quite small, so it would be easy to retarget or, say, replace treecc with, say, a C++-based parse tree. Let me know if you'd like to take a look at the source, but I warn you it was mostly to see how feasible that approach was, not to create a beautiful implementation.

Posted on 2005-12-16 13:08:51

Kildorf

Ruby! :o

Posted on 2005-12-16 13:47:53

mcgrue

For maximum derangedness? PHP.

Why? Because it would be highly inappropriate!

Posted on 2005-12-16 14:27:26

Omni

Python. Deja vu. I like Python, though. Very much so.

Posted on 2005-12-16 15:43:37

mcgrue

RE: Lua.

Why is int/float interoperability bad, jesse? Just enable the float mode and be done with it. It's not as if floats aren't a superset of ints.

Posted on 2005-12-16 21:48:34

mcgrue

...because they are.

Posted on 2005-12-16 21:48:53

Jesse

Quote:
Originally posted by mcgrue

RE: Lua.

Why is int/float interoperability bad, jesse? Just enable the float mode and be done with it. It's not as if floats aren't a superset of ints.



True, but that will break a lot of old code, since 1/2 won't be 0 anymore, it'll be .5. Lua can either be "everything is a float" or "everything is an int".

Posted on 2005-12-16 22:22:47

mcgrue

But it would be mostly compliant, no? That would be balls-out cool to see.

Besides, any compiler-switch won't be in the main tree unless it was 1) mostly compliant and 2) gained the support of most of the community over time, so any Lua addition needn't conform to full compatibility!

Posted on 2005-12-16 22:53:37

Jesse

Good point, Grue; this is why I'm asking for opinions. Certainly, it's mostly compliant. It seems to run VC code I've tested quite nicely (with stubs for builtins, right now.) The cool part with Lua is that it's mallable enough that you could write Lua code that looks almost like VC, too (like, with the same builtin vars and funcs.) And it could call into Lua'd VC and vice-versa.

Lua's got other troubles, though, like I mentioned (ie. no arrays). That's why I'm asking for other ideas before I put too much more work into it.

Posted on 2005-12-16 23:21:35

Overkill

Python is good, because it supports ints, floats, arrays, dictionaries, and strings and is able to be extended by C or C++ code. However, I suppose Python is also evil, because that's how ika was born from Verge 2.7... But then again, we'd only be using Python to handle the compilation of code.

Posted on 2005-12-17 12:26:49

resident

God help me, but I like Verge C.

However, my twisted tendencies are already catered for by VERGE as it stands, so don't let my preferences put you off doing something nifty-awesome :)

Posted on 2005-12-18 03:15:25

Kildorf

I'm not sure everyone is quite grokking what Jesse is talking about here.

We'd still write Verge games in VergeC. Changing that would break older games and we really want to do that as little as possible.

What Jesse is talking about is an internal (ie. invisible) translator. V3 would read in VergeC, and then internally convert it into another language, and then run as if it were that language. This has the dual benefits of letting us continue to use VergeC, but also giving us whatever speed boosts we might get from using the virtual machine for whatever language was translated to.

I'm not making stuff up, am I, Jesse?

Edit: Jesse just informed me that I was correct. Go about your business.

Posted on 2005-12-18 07:44:12 (last edited on 2005-12-18 11:01:21)

Omni

Er...nevermind. Pick the best language.

Posted on 2005-12-18 12:13:38

blues_zodiakos

How about C#? :D

C# Script Engine

Too bad mono isn't really standard yet, and it would be hard to maintain portability.

Posted on 2005-12-18 13:43:28 (last edited on 2005-12-18 13:45:47)

mcgrue

Oh, I see.

Actually, vergec implemented as a .NET language would let you use the .NET backend and keep vergec to a tee.

The problem is the afforementioned mono not being quite ubiquitous, and also verge becoming dependant upon runtimes.

What about TinyC, Jesse?

Posted on 2005-12-18 16:38:54

Jesse

Is there a standard TinyC implementation that could be easily embedded into verge? I can't find one.

Posted on 2005-12-18 17:03:24

mcgrue

No, probably not.

Is Lua's arraylessness a systemic thing? No pointer-math hacks around such things?

(Yes, I know nothing about Lua in specific, I'm just tossing out idears.)

Posted on 2005-12-18 19:58:28

Jesse

I think Lua is pretty strictly hashes-only. We can, of course, simply implement arrays in C and use those, but that kinda defeats the purpose of using another VM if we have to write half of it in C.

Right now, I've got it translating to C++, so I can embed it in verge. Right now my current project is written in VC, but then translated to C++ and compiled into the verge core. This results in a large speed boost, as you might imagine.

Anyway, I think something like python is the way to go. I will investigate this option further.

Posted on 2005-12-18 22:38:01

mcgrue

Bah, hashes-only works for backend array impl, Jesse. Just hash to sequential numeric keys!

Posted on 2005-12-19 00:48:42

Jesse

Yes, they're just slower (especially to create! You have to assign each index.) and memory hogs.

Posted on 2005-12-19 09:12:32


Displaying 1-20 of 26 total.
12 next
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.