WiiLi Wiki frontpage Include your post in the News Get links Hoteles Quito
WiiLi.org Forum Index WiiLi.org
a new revolution
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How GlovePIE works
Goto page 1, 2  Next
 
Post new topic   Reply to topic    WiiLi.org Forum Index -> OpenPIE
View previous topic :: View next topic  
Author Message
CarlKenner
Site Admin


Joined: 29 Nov 2006
Posts: 614

Digg It
PostPosted: Fri Aug 17, 2007 12:00 am    Post subject: How GlovePIE works

The first thing you need is a lexer, also known as a scanner, or tokenizer, to break up the code into words. In the real GlovePIE the same lexer is used for both the compiler and for the syntax highlighter.

The lexer in glovePIE is more complicated than normal. I recommend writing it yourself rather than using an automatic compiler generator. But start with something simple which should recognise the main keywords, and symbols like >=, and comments. The lexer needs a function to check what the current word/symbol is, and another function to move onto the next symbol.

The next thing you need is a parser. The parser in GlovePIE converts the entire script into a list of objects, each object representing a statement. Expressions are also stored in objects. Basically GlovePIE just goes through the list of objects, executing each one. You will probably need to write your own parser, rather than using a compiler generator, due to some complexities of the language.

The parser needs to start with a function called ParseLine which returns an object representing a command (or null for blank lines). This function will check what the first symbol is and then call appropriate functions like ParseAssignmentStatement, ParseIfStatement, etc.

Expressions need to be represented by objects. There needs to be an object for all kinds of expressions, eg. ConstantExpression, UnaryOp, BinaryOp, WiimoteField, KeyboardField, etc. Each expression object needs a function to get the value, a function to get the data type, a function to get the units, a function to set the value, etc.

The data types can be boolean, integer, scalar, 3d vector, 3x3 rotation matrix, or string. Booleans, integers and scalars are all stored as double precision floating point.

I'll explain some more later.
Back to top
View user's profile Send private message Send e-mail
abstrakraft



Joined: 27 Dec 2006
Posts: 107

Digg It
PostPosted: Fri Aug 17, 2007 2:51 am    Post subject:

Out of curiousity - why do you recommend against parser/lexer generators (e.g. yacc and lex)? I've written small languages of similar complexity to GlovePIE's, and I must say, I'd have nightmares about doing it manually.
_________________
"I seldom let practicality get in the way of my fascination with shiny things and blinky lights."
- some guy
http://abstrakraft.org/cwiid
Back to top
View user's profile Send private message
SwedishFrog
Site Admin


Joined: 25 Jan 2007
Posts: 273
Location: New York

Digg It
PostPosted: Tue Aug 28, 2007 11:07 pm    Post subject:

Thank you Carl. I'd love to start implementing these things.

Expressions are stored as objects, eh? Neat trick.

What I'd like to know about is the design of the threading in GlovePIE. What I mean to say is, tell me about how you loop the script as a whole, and subsequently how you loop the insides of If statements and things like that.


Last edited by SwedishFrog on Sun Nov 11, 2007 5:58 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website AIM Address
tic



Joined: 18 Feb 2007
Posts: 121

Digg It
PostPosted: Wed Oct 03, 2007 5:48 pm    Post subject:

I dont understand what all the fuss is with the language. it will take a while, but should be simple enough. how to loop the script will be trivial.

the real answer i want to know is how the automatic connecting with bluesoleil works!? Confused
Back to top
View user's profile Send private message
Cha0s
Site Admin


Joined: 17 Jan 2007
Posts: 469

Digg It
PostPosted: Wed Oct 03, 2007 10:26 pm    Post subject:

BlueSoleil -> BlueCove -> WiiRemoteJ -> OpenPIE. Smile

Simple. Swedish is right. We need to figure out the scripting. That'll be the hardest part. Mapping things to WiiRemoteJ functions should be a piece of cake.

EDIT: fixied my chain of connectiveness and added a comment on our priorities. Wink
_________________
Cha0s


Last edited by Cha0s on Thu Oct 04, 2007 4:22 am; edited 1 time in total
Back to top
View user's profile Send private message
SwedishFrog
Site Admin


Joined: 25 Jan 2007
Posts: 273
Location: New York

Digg It
PostPosted: Thu Oct 04, 2007 3:41 am    Post subject:

tic -- it depends alot on the implemention, so I'd like to know how carl went about it.
Back to top
View user's profile Send private message Visit poster's website AIM Address
tic



Joined: 18 Feb 2007
Posts: 121

Digg It
PostPosted: Thu Oct 04, 2007 9:16 am    Post subject:

so how is openpie coming along? is there anything that can be tested out? or some code I could have a look through?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> OpenPIE All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group