The Piet Forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

High Level Language Compiled to Piet

2 posters

Go down

High Level Language Compiled to Piet Empty High Level Language Compiled to Piet

Post  captncraig Fri Nov 06, 2009 8:12 pm

I have been working on a programming language that I won't hate to use, that can compile into piet.
I know npiet-foogol exists, but I can't stand that language, it doesn't have all the features I
would want, and the implementation is quite buggy. I've been working on a language I have been calling
pdl (piet description language... lame I know, any suggestions are welcome). Source looks something like this:

Code:
var x = 7;
var i = 10;

while( i > 0){
   x = x + i;
   i = i - 1;
}

//Arrays!
arr a[10];
i = 0;
while(i < 10){
   a[i] = i;
   i = i + 1;
}

Theres quite a bit more included, but thats a taste. The idea is to have a c-like syntax that is easy to
code in. The piet code generated will not necessarily be pretty or compact, but it will work.
Currently I have most of the grammar and parser generated and have begun working on code generation.
Currently I have a framework running. For the code:
Code:

var x = 4 - (5 + 3) * 7;
var y = -7;
var z;
y = z + 2;
x = 4;

It generates this code:

High Level Language Compiled to Piet Npiet-10

Which correctly executes leaving the proper values in the proper places.

I took a page from npiet-foogol to get the back and forth structure of the code, except I spread it out a bit, because its a pain to resolve what to do if two vertically adjacent codels are the same color. I got foogol to bug out a few times because of its trying to cram lines together, and I'd rather not deal with that at present. The width is configurable to any size, but I ran this at 24 wide to show how it handles the line wrapping. I'm still developing the language spec and working on the compiler, so I am more than open to feature requests or idea

captncraig

Posts : 5
Join date : 2009-09-18

Back to top Go down

High Level Language Compiled to Piet Empty Re: High Level Language Compiled to Piet

Post  Batmanifestdestiny Fri Feb 12, 2010 11:21 am

I think that's a wonderful idea! The only feature I could think of to add would be being able to choose your start color.
Batmanifestdestiny
Batmanifestdestiny
Admin

Posts : 21
Join date : 2009-07-15

https://piet.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum