This commit is contained in:
Victor Fernandes 2017-03-13 13:02:25 -04:00
parent 2b8186baa0
commit 38fc2ad581
1 changed files with 21 additions and 21 deletions

View File

@ -22,7 +22,7 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all
| <integer literal> | <string literal> | <separator> | <operator> | <integer literal> | <string literal> | <separator> | <operator>
``` ```
### 2.2 White Space ### 2.2 White Space
``` ``` bnf
<white space> ::= <white space> ::=
ASCII SP character (space) ASCII SP character (space)
| ASCII HT character (horizontal tab) | ASCII HT character (horizontal tab)
@ -34,7 +34,7 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all
CR | LF | CR LF CR | LF | CR LF
``` ```
### 2.3 Comments ### 2.3 Comments
``` ``` bnf
<comment> ::= <comment> ::=
!< <opt_characters in line> <line terminator> !< <opt_characters in line> <line terminator>
@ -45,7 +45,7 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all
<input character> but not <line terminator> <input character> but not <line terminator>
``` ```
### 2.4 Variable Identifiers ### 2.4 Variable Identifiers
``` ``` bnf
<variable identifier> ::= <variable identifier> ::=
<arithmetic variable identifier> | <string variable identifier> <arithmetic variable identifier> | <string variable identifier>
@ -68,12 +68,12 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all
<arithmetic variable identifier># <arithmetic variable identifier>#
``` ```
### 2.5 Keywords ### 2.5 Keywords
``` ``` bnf
<keyword> ::= <keyword> ::=
PLATYPUS | IF | THEN | ELSE | USING | REPEAT | INPUT | OUTPUT PLATYPUS | IF | THEN | ELSE | USING | REPEAT | INPUT | OUTPUT
``` ```
### 2.6 Integer Literals ### 2.6 Integer Literals
``` ``` bnf
<integer literal> ::= <integer literal> ::=
<decimal integer literal> | <octal integer literal> <decimal integer literal> | <octal integer literal>
@ -103,15 +103,15 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all
``` ```
### 2.7 Floating-point Literals ### 2.7 Floating-point Literals
``` ``` bnf
<floating-point literal> ::= <floating-point literal> ::=
<decimal integer literal> . <opt_digits> <decimal integer literal> . <opt_digits>
``` ```
### 2.8 String Literals ### 2.8 String Literals
``` ``` bnf
<opt_string literal> ::= <opt_string literal> ::=
ε | <string literal> ε | <string literal>
<string literal> ::= <string literal> ::=
"<opt_string characters>" "<opt_string characters>"
@ -122,12 +122,12 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all
<input character> | <string characters> <input character> <input character> | <string characters> <input character>
``` ```
### 2.9 Separators ### 2.9 Separators
``` ``` bnf
<separator> ::= <separator> ::=
( | ) | { | } | , | ; | " |. ( | ) | { | } | , | ; | " |.
``` ```
### 2.10 Operators ### 2.10 Operators
``` ``` bnf
<operator> ::= <operator> ::=
<arithmetic operator> | <string concatenation operator> <arithmetic operator> | <string concatenation operator>
| <relational operator> | <logical operator> | <relational operator> | <logical operator>
@ -150,7 +150,7 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all
``` ```
## 3. The PLATYPUS Syntactic Specification ## 3. The PLATYPUS Syntactic Specification
### 3.1 PLATYPUS Program ### 3.1 PLATYPUS Program
``` ``` bnf
<program> ::= <program> ::=
PLATYPUS {<opt_statements>} SEOF PLATYPUS {<opt_statements>} SEOF
@ -161,7 +161,7 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all
<statement> | <statements> <statement> <statement> | <statements> <statement>
``` ```
### 3.2 Statements ### 3.2 Statements
``` ``` bnf
<statement> ::= <statement> ::=
<assignment statement> <assignment statement>
| <selection statement> | <selection statement>
@ -170,7 +170,7 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all
| <output statement> | <output statement>
``` ```
### 3.3 Assignment Statement ### 3.3 Assignment Statement
``` ``` bnf
<assignment statement> ::= <assignment statement> ::=
<assignment expression> ; <assignment expression> ;
@ -179,18 +179,18 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all
| <string variable identifier> = <string expression> | <string variable identifier> = <string expression>
``` ```
#### 3.2.2 Selection Statement (`if` statement) #### 3.2.2 Selection Statement (`if` statement)
``` ``` bnf
<selection statement> ::= <selection statement> ::=
IF (<conditional expression>) THEN <opt_statements> IF (<conditional expression>) THEN <opt_statements>
ELSE {<opt_statements>}; ELSE {<opt_statements>};
``` ```
#### 3.2.3 Iteration Statement (the loop statement) #### 3.2.3 Iteration Statement (the loop statement)
``` ``` bnf
<iteration statement> ::= <iteration statement> ::=
USING (<assignment expression> , <conditional expression>, <assignment expression>) REPEAT { <opt_statements> }; USING (<assignment expression> , <conditional expression>, <assignment expression>) REPEAT { <opt_statements> };
``` ```
#### 3.2.4 Input Statement #### 3.2.4 Input Statement
``` ``` bnf
<input statement> ::= <input statement> ::=
INPUT (<variable list>); INPUT (<variable list>);
@ -201,13 +201,13 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all
<variable identifier> | <variable list>,<variable identifier> <variable identifier> | <variable list>,<variable identifier>
``` ```
#### 3.2.5 Output Statement #### 3.2.5 Output Statement
``` ``` bnf
<output statement> ::= <output statement> ::=
OUTPUT(<opt_variable list> | <opt_string literal>); OUTPUT(<opt_variable list> | <opt_string literal>);
``` ```
### 3.3 Expressions ### 3.3 Expressions
#### 3.3.1 Arithmetic Expressions #### 3.3.1 Arithmetic Expressions
``` ``` bnf
<arithmetic expression> ::= <arithmetic expression> ::=
<unary arithmetic expression> <unary arithmetic expression>
| <additive arithmetic expression> | <additive arithmetic expression>
@ -233,7 +233,7 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all
| (<arithmetic expression>) | (<arithmetic expression>)
``` ```
#### 3.3.2 String Expression #### 3.3.2 String Expression
``` ``` bnf
<string expression> ::= <string expression> ::=
<primary string expression> <primary string expression>
| <string expression> << <primary string expression> | <string expression> << <primary string expression>
@ -243,7 +243,7 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all
| <string literal> | <string literal>
``` ```
#### 3.3.3 Conditional Expression #### 3.3.3 Conditional Expression
``` ``` bnf
// BNF from C specification adapted to PLATYPUS // BNF from C specification adapted to PLATYPUS
// source: https://cs.wmich.edu/~gupta/teaching/cs4850/sumII06/The%20syntax%20of%20C%20in%20Backus-Naur%20form.htm // source: https://cs.wmich.edu/~gupta/teaching/cs4850/sumII06/The%20syntax%20of%20C%20in%20Backus-Naur%20form.htm
<conditional expression> ::= <conditional expression> ::=
@ -259,7 +259,7 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all
// END BNF from C specification // END BNF from C specification
``` ```
#### 3.3.4 Relational Expression #### 3.3.4 Relational Expression
``` ``` bnf
<relational expression> ::= <relational expression> ::=
<primary a_relational expression> <relational operator> <primary a_relational expression> <primary a_relational expression> <relational operator> <primary a_relational expression>
| <primary s_relational expression> <relational operator> <primary s_relational expression> | <primary s_relational expression> <relational operator> <primary s_relational expression>