| View previous topic :: View next topic |
| Author |
Message |
SwedishFrog Site Admin

Joined: 25 Jan 2007 Posts: 273 Location: New York
Digg It |
Posted: Thu Jul 12, 2007 9:32 pm Post subject: OpenPIE: How you can help. |
|
|
Hey folks
It has become clear that due to time constraints from work and life in general that I don't have time lately to work on OpenPIE. However, I still want to make this thing happen, so I'm posting this to show you how you can help put this project together. All you need is basic familiarity with Java, and knowledge of WiiRemoteJ will help as well.
What we need to put in place right now is the compiler for the OpenPIE code. This post will show you how you can contribute to making the compiler work.
The compiler does two things. Step one is to establish the grammer, which recognizes what code you have written. Step two is the actions which the program will execute when those commands have been recognized.
Luis has been very diligent on this project and has already put into place a large part of the grammer. It's the actions which need to be added at this point. This is actually quite simple to do, and I'm going to show you how.
The Compiler is written in a language called JavaCC. It's a compiler construction language, or a language whose purpose is to define the grammar and actions for the compiler. You can call it a "Compiler Compiler" if you will. The grammar is written in the JavaCC language. The actions are embedded in the JavaCC functions within pairs of {Squiggly Braces}.
Every kind of statement you define is represented by a function in JavaCC. Also, pieces of statements are also represented by functions. What's great about JavaCC is that you can write the Actions in regular old Java code. I'll go over a simple example of a print statement.
Note: This code is an exerpt. It will not compile on its own; it's just an example I typed up.
| Code: |
void printStatement(): {Token t;}
//This starts the function (aka production). JavaCC knows to call this function when it sees the word "Print" (ie. due to the first line of code inside this function).
//t is a local variable which holds the inside part of the print statement.
{ //Start JavaCC code
"Print" //Expect the text "Print"
"(" //Expect a '('
t = expression() //Expect an expression and store it in t
")" //Expect a ')'
";" //Expect a ';'
{ //Start of Java action. This makes the print statement actually do something.
System.out.println(t); //Print the contents of t using regular Java code.
} //End Java code
}
|
That's basically it. There may be some syntax problems in the example (I didn't compile it) but that's the basic idea.
I have an example of a Compiler I wrote which is a subset of the C language, whose actions spit out assembly code. If you guys want, I can post it here so you can look at it.
Post here or contact me if you have any questions. Let's make it happen. |
|
| Back to top |
|
 |
luis_villase Site Admin

Joined: 28 Nov 2006 Posts: 172 Location: Mexico City, Mexico
Digg It |
Posted: Fri Jul 13, 2007 2:42 pm Post subject: |
|
|
If someone wants to help, I will gladly give them the basic grammar so we can start working on it. So contact me or Mark for details. _________________ Not all mexicans enjoy tamales and piƱatas, and tacos aren't really made that way!
Luis V. |
|
| Back to top |
|
 |
TiagoTiago
Joined: 20 Jan 2007 Posts: 710 Location: Brasil
Digg It |
Posted: Fri Jul 13, 2007 5:10 pm Post subject: |
|
|
| luis_villase wrote: | | If someone wants to help, I will gladly give them the basic grammar so we can start working on it. So contact me or Mark for details. |
couldn't this be placed on a public readable (at least) wiki ir somthing like that? _________________ please put the scripts on the wiki so they dont get lost as new stuff is posted!
phpBB doesnt like me,somtimes it will forget to warn me about new replies to threads I asked it to,if you see a thread I should have responded, could please email me? |
|
| Back to top |
|
 |
SwedishFrog Site Admin

Joined: 25 Jan 2007 Posts: 273 Location: New York
Digg It |
Posted: Fri Jul 13, 2007 5:43 pm Post subject: |
|
|
| You're right. It's on SVN. We should give out developer accounts |
|
| Back to top |
|
 |
Cha0s Site Admin
Joined: 17 Jan 2007 Posts: 493
Digg It |
Posted: Fri Jul 13, 2007 6:40 pm Post subject: |
|
|
Don't be too hasty giving out dev access. As long as there're a couple active devs, it's better to work with a patch submission system (i.e. write a little code, send it in, dev checks it, commits). We don't want the project getting too cluttered with hasty unchecked (potentially erroneous) commits. Given the current size of the project, I'd say there should be no more than five people committing code (and we could easily do with less). I'd definitely publicize the SVN server, though, and request patch submissions. If someone submits a bunch of good patches, give them dev access.  _________________ Cha0s |
|
| Back to top |
|
 |
SwedishFrog Site Admin

Joined: 25 Jan 2007 Posts: 273 Location: New York
Digg It |
Posted: Fri Jul 13, 2007 6:47 pm Post subject: |
|
|
| That's true. Anyway there's only a limited number of people who'd really be able to help with the compiler development in the first place; It's not really something you'd trust a beginner with |
|
| Back to top |
|
 |
fortunzfavor

Joined: 13 Jun 2007 Posts: 95
Digg It |
Posted: Sat Aug 04, 2007 8:26 pm Post subject: |
|
|
bump (so it's the first thing people see when they come in the forum) _________________ WiiHD |
|
| Back to top |
|
 |
|