From 2b8186baa041acfd0279ef9b0f37e8b47458d9f8 Mon Sep 17 00:00:00 2001 From: Victor Fernandes Date: Mon, 13 Mar 2017 12:58:58 -0400 Subject: [PATCH] Fix opt statement productions, start regex for literals --- PLATYPUS Grammar Specification.md | 20 ++++++++++++- PLATYPUS_Regex.md | 47 +++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 PLATYPUS_Regex.md diff --git a/PLATYPUS Grammar Specification.md b/PLATYPUS Grammar Specification.md index 5e764b5..7cad763 100644 --- a/PLATYPUS Grammar Specification.md +++ b/PLATYPUS Grammar Specification.md @@ -52,6 +52,9 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all ::= + ::= + ε | + ::= | @@ -77,6 +80,9 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all ::= 0 | + ::= + ε | + ::= | @@ -103,10 +109,16 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all ``` ### 2.8 String Literals ``` + ::= + ε | + ::= "" - ::= + ::= + ε | + + ::= | ``` ### 2.9 Separators @@ -142,6 +154,9 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all ::= PLATYPUS {} SEOF + ::= + ε | + ::= | ``` @@ -179,6 +194,9 @@ This does not follow standard BNF/EBNF syntax, I will rewrite it once I get all ::= INPUT (); + ::= + ε | + ::= | , ``` diff --git a/PLATYPUS_Regex.md b/PLATYPUS_Regex.md new file mode 100644 index 0000000..f98d368 --- /dev/null +++ b/PLATYPUS_Regex.md @@ -0,0 +1,47 @@ +# Regular Expressions for PLATYPUS +## Comments +``` +L(COMMENT) = !< [^CR]*CR +``` + +## Keywords +``` +L(KEYWORD) = PLATYPUS | IF | THEN | ELSE | USING | REPEAT | INPUT | OUTPUT +``` +## Variable Identifiers +``` +L(LETTER) = [a-zA-Z] + +L(LETTER_OR_DIGIT) = [a-zA-Z0-9] + +L(VID) = AVID | SVID + +L(AVID) = [a-zA-Z]([a-zA-Z0-9])* + +L(SVID) = AVID# + +``` +## Integer Literals +``` + +L(DEC_INT_LITERAL) = [0-9]* + +L(NON_ZERO_DIGIT) = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 + +L(DIGIT) = [0-9]+ + +L(OCT_DIGIT) = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 + +L(OCT_DIGIT_LITERAL) = 0(OCT_DIGIT)+ + +L(INT_LITERAL) = (DEC_INT_LITERAL | OCT_INT_LITERAL) + +``` +## Floating Point Literal +``` +L(FLP_LITERAL) = ([0-9]*).([0-9]+) +``` +## String Literal +``` +L(STR_LITERAL) = "([a-ZA-Z_0-9])*" +``` \ No newline at end of file