diff --git a/PLATYPUS Grammar Specification.md b/PLATYPUS Grammar Specification.md index ad9b3c7..82105ea 100644 --- a/PLATYPUS Grammar Specification.md +++ b/PLATYPUS Grammar Specification.md @@ -6,247 +6,247 @@ ### 2.1 Input Elements and Tokens ``` - -> - ASCII characters but not SEOF + -> + ASCII characters but not SEOF - -> - SEOF + -> + SEOF - -> - | + -> + | - -> - | | - | | | | + -> + | | + | | | | ``` ### 2.2 White Space ``` - -> - ASCII SP character (space) - | ASCII HT character (horizontal tab) - | ASCII VT character (vertical tab) - | ASCII FF character (form feed) - | - - -> - CR | LF | CR LF + -> + ASCII SP character (space) + | ASCII HT character (horizontal tab) + | ASCII VT character (vertical tab) + | ASCII FF character (form feed) + | + + -> + CR | LF | CR LF ``` ### 2.3 Comments ``` - -> - !< + -> + !< - -> - | + -> + | - -> - but not + -> + but not ``` ### 2.4 Variable Identifiers ``` - -> - | + -> + | - -> - + -> + - -> - | - - -> one of - [a-z][A-Z] + -> + | - -> one of - [a-z][A-Z][0-9] + -> one of + [a-z][A-Z] - -> - # + -> one of + [a-z][A-Z][0-9] + + -> + # ``` ### 2.5 Keywords ``` - -> - PLATYPUS | IF | THEN | ELSE | USING | REPEAT | INPUT | OUTPUT + -> + PLATYPUS | IF | THEN | ELSE | USING | REPEAT | INPUT | OUTPUT ``` ### 2.6 Integer Literals ``` - -> - | - - -> - 0 | + -> + | - -> - | + -> + 0 | - -> - 0 | - - -> one of - [1-9] + -> + | - -> - 0 + -> + 0 | + + -> one of + [1-9] + + -> + 0 + + -> + 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 + + -> + | - -> - 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 - - -> - | - ``` ### 2.7 Floating-point Literals ``` - -> - . + -> + . ``` ### 2.8 String Literals ``` - -> - "" + -> + "" - -> - | + -> + | ``` ### 2.9 Separators ``` - -> one of - ( ) { } , ; " . + -> one of + ( ) { } , ; " . ``` ### 2.10 Operators ``` - -> - | - | | - | - - -> one of - + - * / - - -> one of - > < == <> + -> + | + | | + | - -> - .AND. | .OR. + -> one of + + - * / - -> - = + -> one of + > < == <> + + -> + .AND. | .OR. + + -> + = ``` ## 3. The PLATYPUS Syntatic Specification ### 3.1 PLATYPUS Program ``` - -> - PLATYPUS {} SEOF - - -> - | + -> + PLATYPUS {} SEOF + + -> + | ``` ### 3.2 Statements ``` - -> - - | - | - | - | + -> + + | + | + | + | ``` ### 3.3 Assignment Statement ``` - -> - + -> + - -> - AVID = - | SVID = + -> + AVID = + | SVID = ``` #### 3.2.2 Selection Statement (`if` statement) ``` - -> - IF () THEN - ELSE {}; + -> + IF () THEN + ELSE {}; ``` #### 3.2.3 Iteration Statement (the loop statement) ``` - -> - + -> + ``` #### 3.2.4 Input Statement ``` - -> - INPUT (); - - -> - | , + -> + INPUT (); + + -> + | , ``` #### 3.2.5 Output Statement ``` - -> - + -> + ``` ### 3.3 Expressions #### 3.3.1 Arithmetic Expressions ``` - -> - - | + -> + + | - -> - - - | + -> + - + | + -> - + - | - - | - - -> - * - | / - | + -> + + + | - + | - -> - - | - | - | () + -> + * + | / + | + + -> + + | + | + | () ``` #### 3.3.2 String Expression ``` - -> - - | << + -> + + | << - -> - - | + -> + + | ``` #### 3.3.3 Conditional Expression ``` - -> - + -> + - -> - + -> + - -> - + -> + ``` #### 3.3.4 Relational Expression ``` - -> - == - | <= - | > - | < - | == - | <= - | > - | < - - -> - - | - | + -> + == + | <= + | > + | < + | == + | <= + | > + | < - -> - + -> + + | + | + + -> + ``` \ No newline at end of file