init: SDF3/Statix project as initialized by Spoofax
This commit is contained in:
commit
9ecfa63f58
20 changed files with 515 additions and 0 deletions
50
syntax/Common.sdf3
Normal file
50
syntax/Common.sdf3
Normal 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? -/- [\/].[\*]
|
17
syntax/fostr.sdf3
Normal file
17
syntax/fostr.sdf3
Normal file
|
@ -0,0 +1,17 @@
|
|||
module fostr
|
||||
|
||||
imports
|
||||
|
||||
Common
|
||||
|
||||
context-free start-symbols
|
||||
|
||||
Start
|
||||
|
||||
context-free sorts
|
||||
|
||||
Start
|
||||
|
||||
context-free syntax
|
||||
|
||||
Start.Empty = <>
|
Loading…
Add table
Add a link
Reference in a new issue