The OINK Language Project: A Journey in Game Development

Slide Note
Embed
Share

The OINK Language Project, embarked upon by Jesse Hadden for a CSCI 310 assignment, aims to create a new programming language tailored for game development. The journey involves exploring the need for a specialized language in the gaming industry, expressing ambition, facing challenges, and detailing aspects like lexical analysis and function types.


Uploaded on Dec 13, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. OINK Jesse Hadden CSCI 310 Spring 2013

  2. Why OINK? Because that s the sound that piglets make. Piglet -> Pigl -> Pig-L -> Pi-G-L Pi = 3.14 3.14 first letter = TPOF TPOF-G-L -> T.P.O.F.G.L. The Programmers Only Favorite Game-making Language I spent more time coming up with a name than I did actually doing the assignment, but you won t find me putting that in print just in case the professor has a cow. Cow != Piglet.

  3. No, really, why OINK? There are a lot of languages on the market. Some of them are really good (C++) and some are really bad (BASIC), but they are all optimized for general applications. None of them are specifically designed for game creation. Ignore GML GML is the evil mutant offspring of an unholy mating between Javascript and LISP.

  4. ANSWER THE QUESTION: WHY OINK? Because I want to make games, and while C++ is good at it, it does have some limitations. I d like to just take C++ and modify it, but that probably wouldn t fly for this assignment, so here I sit trying to make up a new language as if it will ever be implemented.

  5. Isnt that a bit ambitious? Yes. Yes it is. So what I m REALLY going to do is just come up with a simple language that can program hangman, and call it a day.

  6. Lexical Analysis Function types: main() task function() sub function() Predefined Classes: struct 3dpos { float x float y float z } struct 2dpos { float x float y } struct grid_s { int x int y int z bool 3d } struct grid_h { int x int y int z bool 3d } keyin ( value device ) rangein (value device ) audin (value device ) textout (string ) beep ( value duration )

  7. Lexical Analysis Part 2: Function and Variable declarations: [A-Z][a-z][0-9]+ Excluding the following: 2dpos beep eq false grid_s if le main object rangein stack Switch true while 3dpos bool exit for grid_t inline lint mod oct real string task uchar and char exp ge gt int list new or redefine struct textout uint audin define extentof grid_h hex keyin lt nq queue sizeof sub this ulint

  8. Lexical Analysis Part 3: Lex s Revenge Operator What it does Associativity [] () exp() * / mod + - and or eq nq ++ -- gt lt ge le sizeof() Type casting Parenthetical notation Exponentiation Multiply Divide Modulo Add Subtract Logical AND Logical OR Equality Not equality Increment Decrement Greater than (left to right) Less than (left to right) Greater than or equal to Less than or equal to Size of (integer value for bool, char, uchar, int, uint, lint, ulint; float value for real; number of assigned [non-null] elements for string) Right None None Left Left Left Left Left Left Left Left Left Left Left Left Left Left Left None extentof() Byte size of variable for all but string; for string, total array size None oct() Convert integer or real literal to octal format None hex() Convert integer or real literal to hexadecimal format None = Assignment Right

  9. Lexical Analysis Part 4: Return of the Son of Lex Type Size Range bool 1 byte, unsigned 0 = false 1 or above = true char 1 byte, signed -128 to 127 uchar 1 byte, unsigned 0 to 255 int 2 bytes, signed -32767 to 32768 uint 2 bytes, unsigned 0 to 65535 lint 4 bytes, signed -2147483648 to 2147483647 ulint 4 bytes, unsigned 0 to 4294967295 real 4 bytes, floating point +/- 3.4e +/- 38 (7 digits) string 4 bytes, unsigned Dynamically allocated character array up to 4294967295 characters

  10. Syntax Diagram (ex) Cond Func Expr Main Assign Param (var) Var Func Expr

  11. Syntax Diagram (ex) If Var Assign Cond While Func For Expr Value Assign Var = + - Var * /

  12. Syntax Diagram (ex) Value Type Var Var i [A-Z][a-z][0-9] r c

  13. Syntax Diagram (ex) If Cond True Func Expr While Cond True Func For Cond Equal Expr Func Switch Cond True Expr

  14. Sample Program: Hangman #include random.o #include time.o task main() { define MAX_WRONG int 8 ; list < string > words ; words push ( GUESS ) ; words push ( HANGMAN ) ; words push ( DIFFICULT ) ; seedRand ( stdTime ) ; randomShuffle ( words begin() words end ( ) ) ; define THE_WORD string words [ 0 ] ; int wrong = 0 ; string soFar ( sizeof ( THE_WORD ) + _ ) ; string used = ; textout ( Hangman game ) ; while ( ( wrong lt MAX_WRONG ) and ( soFar nq THE_WORD ) ) { textout ( \nYou have + ( MAX_WRONG wrong ) + incorrect guesses left.\n ) ; textout ( You have used + used + letters.\n ) ; textout ( Word is: + soFar + \n ) ; char guess ; textout ( \nGuess: ) ; keyin ( guess ) ; used += guess ; if ( THE_WORD find ( guess ) nq string npos ) { textout ( Guess correct ) ; } for ( int i = 0 ; i < THE_WORD sizeof ( ) ; i ++ ; ) { if ( THE_WORD [ i ] eq guess ) { soFar [ i ] = guess ; } else { textout ( Wrong guess ) ; } } /* end for loop */ if ( wrong eq MAX_WRONG ) { textout ( Your man has been hanged. ) ; } /* end MAIN */

Related


More Related Content