Skip to content

RavanSA/yacc-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

• 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:

  1. int – it stores integer
  2. String – it holds sequence of element
  3. float - it holds decimal numbers
  4. 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.
  5. For one line, we need to use //
  6. 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.

About

CSE 334 - Yacc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors