init: Spoofax language project as generated

This commit is contained in:
Glen Whitney 2020-12-15 00:24:59 -08:00
commit 79b9392173
20 changed files with 452 additions and 0 deletions

50
syntax/Common.sdf3 Normal file
View file

@ -0,0 +1,50 @@
module Common
lexical sorts
ID INT STRING
STRING_CHAR BACKSLASH_CHAR
COMMENT_CHAR INSIDE_COMMENT
NEWLINE_EOF EOF
lexical syntax
ID = [a-zA-Z] [a-zA-Z0-9]*
INT = "-"? [0-9]+
STRING = "\"" STRING_CHAR* "\""
STRING_CHAR = ~[\"\n]
STRING_CHAR = "\\\""
STRING_CHAR = BACKSLASH_CHAR
BACKSLASH_CHAR = "\\"
LAYOUT = [\ \t\n\r]
COMMENT_CHAR = [\*]
LAYOUT = "/*" INSIDE_COMMENT* "*/"
INSIDE_COMMENT = ~[\*]
INSIDE_COMMENT = COMMENT_CHAR
LAYOUT = "//" ~[\n\r]* NEWLINE_EOF
NEWLINE_EOF = [\n\r]
NEWLINE_EOF = EOF
EOF =
lexical restrictions
// Ensure greedy matching for lexicals
COMMENT_CHAR -/- [\/]
INT -/- [0-9]
ID -/- [a-zA-Z0-9\_]
// EOF may not be followed by any char
EOF -/- ~[]
// Backslash chars in strings may not be followed by "
BACKSLASH_CHAR -/- [\"]
context-free restrictions
// Ensure greedy matching for comments
LAYOUT? -/- [\ \t\n\r]
LAYOUT? -/- [\/].[\/]
LAYOUT? -/- [\/].[\*]

View file

@ -0,0 +1,17 @@
module Spoofax-Propositional-Language
imports
Common
context-free start-symbols
Start
context-free sorts
Start
context-free syntax
Start.Empty = <>