Game
Robot Unlock
13 years ago

The long journey from character to AST... begins elsewhere


Since we’re in full compiler-compiler season I thought it would be appropriate for me to also provide a more educational example. This example illustrates how a very rudimentary* compiler works. In more detail, it shows what happens to your code after it’s been chopped into nice tokens. Then, it shows how, based on these tokens and the language’s grammar an AST is built and then decorated and, finally, how this tree is fed to an interpreter and results start popping up.

By rudimentary I mean that the language consists of simple arithmetic expressions. Below, you can find the compiler-demo. Just type stuff and be amazed!

If you want to find out more about the inner workings of this nifty thing, check this very nicely written article on CodeProject.

<div> Your input code:
7 + pi * (x - 10)
The environment:
{ “x” : 5, “pi” : 3 }
Output:
</div>



0 comments

Loading...

Next up

Heya there! I really wanted to show you all a little gameplay preview of the first boss fight i'm currently working on i hope you like it ^^

Quantum precognition is one of the most powerful cards. End game cards & equipment. Demo/alpha build boss is no match for this deck.

Heya! I wanted to show some gameplay progress i made so far. I hope you like it ^^

In the quest for accessibility, I'm adding Resurrection Shrines for players on the 'novice' end of the platforming spectrum.

In order to unlock the power of a Shrine, you must collect 3 'Souls' from your dead corpses! (the floating blue orbs)

A Shiny Mega Gengar 🌟 For @ManutkArt 's #ThreeColorsChallenge!

A house I've built a while ago. :)

It nicely separates the snowy biome from the grassy one.

It's built with painted Ebonstone.

Showing off player 2 😎

What do you think?

"Day to Day" (also check spud out here he's a great guy and writer: https://soundcloud.com/spudward)

Alone Together....

I mostly build 3D First Person Shooter game mechanics in Unity, and in this I'm just showing C4 mechanics I made for a little side project I am working on! :)