• Project Group Members - Ravan Sadigli(20160807005) • Name of the programming language : “Plang” • Grammar in BNF form : ::= ::= ::=identifier ::= ::=identifier ::= ::=
::= ::= ::=|| ::=|| ::= || ::= | | ::= | :: = | ::= < typeint>| | ::=identifier | identifier = ::= identifier = string ::= identifier = char ::= identifier = | identifier = ::= identifer = |identifier , identifier ::=<|relationexp> ::= if ::= else ::= if | ::= for ( ) ::= ( ) ::= ::= loopend ( ) ; ::= ; ; ::= | ::= :: = ::= try () ::= catch ( ) ::=throw exception ::= package identifier ; ::= import identifier . *;| import identifier.* ::= printing (); ::= scanner (); ::= exit_success; ::= // | /*--------*/ ::= | | ::= | | . ::= true | false ::= | | ::= ::= | ::= and | or ::= ++ |-- |< | <= | > | >= | != | == ::= + | - | * | / | = ::=0 | 1 |....| 9• Explaining to the syntax of the language Plang is designed as a simple programming language. The syntax of the language looks like java. The beginning of Pl begins with the package and import. Then, we need to set the name of the class, which starts with the public class or class as in java, and it followed by the main method. There are four primitive types in the Plang. These are int, String, float, and boolean. Its purposes are described below:
- int – it stores integer
- String – it holds sequence of element
- float - it holds decimal numbers
- boolean – it stores only two possible values, true or false. Also, conditional statements are available in this programming language. The syntax is the same as in Java (basic if and if-else statements). There are func keywords used for the defining method. Methods are defined outside the main method, and we can call the method inside the smain method. And, we can use the loop using the for keyword. To end the loop, we need to use the endloop keyword. Comments are also similar to java. And, the data in the comments are ignored by the compiler.
- For one line, we need to use //
- For multi line, we need to /..../ It also has methods like scan and printing. And, we can stop the execution using the exit keyword. And, the example of the plang can be found in the file called example.plang.