Advertisement Jump to content
  • Advertisement
  • entries
  • comments
  • views

Epoch Postcount++

Sign in to follow this  


Finally got infix operators working correctly with precedence rules. Along the way I managed to implement support for parenthetical expressions. That means that this entire unit test now passes:

// Tests for validating infix operator behaviour (particularly operator precedence)
// Also includes tests for unary operators and parenthetical expressions

entrypoint : () -> ()
debugwritestring(cast(string, 38 + 5 - 1))
debugwritestring(cast(string, 51 - 9))

debugwritestring(cast(string, 40 + 2))
debugwritestring(cast(string, 50 - 10 + 2))
debugwritestring(cast(string, 50 + 2 - 10 - 42 + 22 + 18 + 2))

debugwritestring(cast(string, 2 + 10 * 4))
debugwritestring(cast(string, 14 * 2 - 8 + 20 + 6 * 2 - 10))

debugwritestring(cast(string, -2))
debugwritestring(cast(string, 44 + -2))
debugwritestring(cast(string, -2 + 44))

integer(quux, 0)
quux = bletch() - 1
debugwritestring(cast(string, quux))

debugwritestring(cast(string, 2 + echo(1 + 1)))
debugwritestring(cast(string, (4 + 7)))
debugwritestring(cast(string, 30 + (4 + 7)))
debugwritestring(cast(string, 30 + (4 + 7) + 1))
debugwritestring(cast(string, (9 + 2) * (4 - 2)))
debugwritestring(cast(string, ((4 - 1) + 6) * 2))
debugwritestring(cast(string, 2 * ((4 - 1) + 6)))
debugwritestring(cast(string, bletch() / 2))

// Just tests of the assignment operator
integer(baz, 42)
quux = 3
baz = 0
baz = 1 + 1
baz = baz * 2
baz = quux
baz = quux = 42
debugwritestring(cast(string, baz))
debugwritestring(cast(string, quux))

baz = quux = sanitycheck("test", "xorph")
debugwritestring(cast(string, baz))

bletch : () -> (integer(ret, 43))

echo : (integer(x)) -> (integer(ret, x))

plus : (integer(x), integer(y)) -> (integer(ret, x + y))

sanitycheck : (string(a), string(b)) -> (integer(ret, 42))


Next step is to implement support for unary operators like preincrement/postincrement, bitwise/logical NOT, and so on. This shouldn't be too hard as I already have the experience from the last compiler iteration, but then again, I thought the same thing about operator precedence, and that took all day to get right... so, who knows.

The bug list filed against Release 10 continues to dwindle; the final set of issues looks something like this at the moment:

  • Implement unary operators

  • Implement free blocks (artificial scopes)

  • Implement flow control entities

  • Final unit test triage

  • Update documentation/wiki pages

Unary operators are a wildcard, but again shouldn't be terribly difficult. Free-standing blocks will take some effort as I need to review the way lexical scopes are handled; right now nested scopes are not really supported at all, so that may require a bit of heavy lifting in the parser and virtual machine to make everything run correctly.

Once lexical scoping is working, adding flow control back into the language should go quickly. It's mainly just a matter of adding hooks in the entity system to allow for conditional and/or repeated execution of an entity. I'll probably need some VM-level support for this with special flow control instructions, but I want to try and avoid hard-coding too much stuff into the VM, so that I can easily add entities for things like automatically parallelized loops and so on.

With the feature work out of the way, it'll just be a matter of making sure all the appropriate unit tests still pass, and then doing some documentation work. I intend to write up a proper tutorial on the new features of the language (mainly pattern matching and function overloading) as well as some technical docs on how the standard library works and how the standard entities (i.e. flow control) are implemented.

So all told probably another couple of weekends at a minimum, plus polishing time and whatever other stuff crops up along the way.

After Release 10 goes out the door, it'll be time to look towards the traditional GDC 2011 Preview Kit release. I'm not sure if the GDC'11 kit will be Release 11 or Release 12; it really depends on how much time I can dig up between now and then. R11 will primarily focus on getting Win32 support back into the language, so that it's possible to write real software that lives beyond the confines of the console and its limited debug interactivity. Assuming that goes well, R12's goal will be to reintroduce all of the parallelism features of former releases. In particular I want R12 to have some solid threading and CUDA support, and possibly an OpenCL cross-compiler as well.

Whether R11 or R12 goes to GDC, I want to write a simple, quick arcade-type game that shows off the language. Something like a Raptor clone appeals to me; the artwork should be easy enough even for a hack like myself, and there's no sophisticated logic or complex balancing or any of that jazz to make life difficult. Just a couple different enemies, a few weapons, a boss, and some simple cartoonish artwork, and I'll have a demo.

The plan here is to have the demo ready for GDC'11, so that I can finally prove that Epoch is a viable language for game development - which, after all, was what it was originally meant to be!

So... all that said, I'm pretty stoked about the whole thing. The language is finally shaping up into something that's enjoyable to use, and with a little more investment, it should be a powerfully kick-ass platform for development.

For now, though, I really, really need some sleep.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!