Project Name: Dodgeball
Group Members: Sevda Gülen - Ceren Bülbül
How it runs?
- make dodgeball
- ./dodgeball2 < example1.ddg
- ./dodgeball2 < example2.ddg
-
< program > : program < statements > program | STARTGAME program | ENDGAME | error
-
< statement > : creationStatement | dieStatement | printnumberStatement | scannerStatement | IfElseStatement | IfElseifElseStatement | IfProvideOtherwiseStatement | whileStatement | asStatement | ifThenStatement | functionStatement | changeStatement | commentStatement | assignmentStatement | actionStatement | resultStatement | printStringStatement | boolStatement | heartStatement | funStatement | DDGStatement
-
< heartStatement > : HEART
-
< printStringStatement > : PRINT STRING
-
< printnumberStatement > : PRINT term
-
< assignmentStatement > : IDENTIFIER '=' exp
-
< boolExpression > : term EQ term | term B term | term S term | term BE term | term SE term | term AND term | term OR term
-
< funStatement > : FUN FUNNAME statements RETURN statements SEMICOLON
-
< commentStatement > : COMMENT
-
< creationStatement > : CREATE CHILDREN | creationStatement ROLE numericType | CHILDREN AND CHILDREN '=' TEAM
-
< dieStatement > : DIE CHILDREN
-
< scannerStatement ? : SCANNER
-
< changeStatement > : CHANGE
-
< boolStatement > : INTEGER EQ INTEGER | INTEGER B INTEGER | INTEGER S INTEGER | INTEGER BE INTEGER | INTEGER SE INTEGER | INTEGER AND INTEGER | INTEGER OR INTEGER | '(' boolStatement ')'
-
< actionStatement > : CHILDREN ACTION numericType
-
< IfProvideOtherwiseStatement > : IFPROVIDE expression statements OTHERWISE statements
-
< IfElseStatement > : IF boolExpression exp ELSE exp SEMICOLON
-
< IfElseifElseStatement > : IF expression statements elseifStatement ELSE statements
-
< elseifStatement > : ELSEIF expression statements elseifStatement
-
< ifThenStatement > : IF expression THEN statements
-
< functionStatement > : CHILDREN ACTION | functionStatement numericType | ROLE numericType
-
< asStatement > : AS expression statements
-
< DDGStatement > : DDG
-
< whileStatement > : WHILE term S term RETURN exp SEMICOLON | WHILE term B term RETURN exp SEMICOLON | WHILE term S term RETURN PRINT exp SEMICOLON | WHILE term B term RETURN PRINT exp SEMICOLON
-
< resultStatement > : TEAM GAMERESULT AND TEAM GAMERESULT | GAMERESULT
-
< expression > : comparisonExpression | | actionExpression | orExpression| andExpression | boolExpression
-
< exp > : term | exp '+' term | exp '-' term
-
< boolExpression > : term EQ term | term B term | term S term | term BE term | term SE term | term AND term | term OR term
-
< actionExpression > : CHILDREN ACTION
-
< comparisonExpression > : numericType assignmentOperator numericType | IDENTIFIER assignmentOperator numericType | CHILDREN numericType assignmentOperator CHILDREN numericType '+' numericType | IDENTIFIER assignmentOperator IDENTIFIER
-
< orExpression > : BOOL OR BOOL
-
< andExpression > : BOOL AND BOOL
-
< assignmentOperator > : EQ | BE | SE | B | S
-
< numericType > : STRENGTH | HEALTH | BALLSPEED | INTEGER
-
< term > : INTEGER | IDENTIFIER
➡️ Bold text is token.
STARTGAME
//something//
ENDGAME
STARTGAME
CREATE SEVDA
CREATE CEREN ESCAPER(8)
ENDGAME
Created: SEVDA
Created: CEREN
STARTGAME
a = 5
PRINT:"LET'S START GAME"
PRINT:a
ENDGAME
LET'S START GAME
5
STARTGAME
s = 10
AS s > 2
//something//
s = s+2
ENDGAME
STARTGAME
IFPROVIDE SEVDA CATCHING
s = s +5
OTHERWISE
SEVDA ESCAPING
ENDGAME
STARTGAME
DIE SEVDA
ENDGAME
died: SEVDA
STARTGAME
BOB THROWING(4.6)
ROBI ESCAPING
ENDGAME
STARTGAME
IFPROVIDE a < b
B WIN AND A LOST
OTHERWISE
DRAW
ENDGMAE
STARTGAME
3==3
4>=6
ENDGAME
TRUE
FALSE
STARTGAME
IF 3<6 3 ELSE 6
ENDGAME
3
STARTGAME
WHILE 3<7 RETURN PRINT:3;
i = 3
s = 5
WHILE i<6 RETURN s+2;
ENDGAME
3
3
3
3
21
STARTGAME
FUN functionname: IF 2>3 2 ELSE 3; RETURN a = 3-2;
ENDGAME
3
STARTGAME
ASdsks;
Wrong Gramer
This language, as the name implies, is a language made for "dodgeball" game. It is a language inspired by the movements, players and situations made while playing this game. At the same time, primitive calculations can be done in boolean operations, if else, function definition and loop. There are some features that distinguish this language from other languages and make it good:
🔸 Features that are not available in other languages have been added in this language. With these features, processes that take a very long time can be done in a short time.
🔸 It is easy for people to perceive and understand because it is very similar to the daily writing language.
🔸 Since there is an error handling, the system does not throw itself out in every written error. After making the mistake, you can continue to correct the error and write code.
🔸 Apart from being a different language, transactions in primitive languages are also included. Thus, it is a language that will be more familiar to people.
🔸 Instant transactions can be printed. In this way, you will understand and see if your code is going wrong or not.