init commit again
This commit is contained in:
9
IBAF-Editor/syntax/Funcons-pp.sdf3
Normal file
9
IBAF-Editor/syntax/Funcons-pp.sdf3
Normal file
@@ -0,0 +1,9 @@
|
||||
module Funcons-pp
|
||||
|
||||
imports Funcons
|
||||
|
||||
context-free syntax
|
||||
|
||||
FCT.FCTAppComp = <
|
||||
<{NAME " "}+>
|
||||
<FCT> > // for pp only
|
||||
87
IBAF-Editor/syntax/Funcons.sdf3
Normal file
87
IBAF-Editor/syntax/Funcons.sdf3
Normal file
@@ -0,0 +1,87 @@
|
||||
module Funcons
|
||||
|
||||
context-free start-symbols
|
||||
Start
|
||||
|
||||
context-free syntax
|
||||
Start = FCT {avoid}
|
||||
|
||||
FCT-SEQ.FCTSequence = <
|
||||
<FCT-SEQ>,
|
||||
<FCT-SEQ>> {right}
|
||||
FCT-SEQ.FCTEmpty =
|
||||
FCT-SEQ = FCT
|
||||
|
||||
FCT.FCTInt =
|
||||
INT
|
||||
FCT.FCTFloat =
|
||||
FLOAT
|
||||
FCT.FCTChar =
|
||||
CHAR
|
||||
FCT.FCTString =
|
||||
STRING
|
||||
FCT.FCTDoubleQuoted =
|
||||
<\\"<FCT-Quoted>\\">
|
||||
FCT.FCTVar
|
||||
= VAR
|
||||
FCT.FCTName
|
||||
= NAME
|
||||
FCT.FCTApp = <
|
||||
<NAME> <FCT> >
|
||||
// FCT.FCTSemantics = SEM-NAME PHRASE-FCT FCT?
|
||||
FCT.FCTTyped = <
|
||||
<FCT>:<FCT> > {non-assoc}
|
||||
FCT.FCTComplement = <
|
||||
~ <FCT> >
|
||||
FCT.FCTComputes = <
|
||||
<FCT?> =\> <FCT> > {non-assoc}
|
||||
FCT.FCTPostfix = <
|
||||
<FCT><POSTFIX> >
|
||||
FCT.FCTUnion = <
|
||||
<FCT> | <{FCT " | "}+> >
|
||||
FCT.FCTIntersect = <
|
||||
<FCT> & <{FCT " & "}+> >
|
||||
FCT.FCTGroup = <
|
||||
(<FCT-SEQ>) >
|
||||
FCT.FCTList = <
|
||||
[<FCT-SEQ>] >
|
||||
FCT.FCTSet = <
|
||||
{<FCT-SEQ>} >
|
||||
FCT.FCTMap = <
|
||||
{<{FCT-POINT ",\n"}*>} >
|
||||
|
||||
FCT-POINT.Point = <
|
||||
<FCT> |-\> <FCT> >
|
||||
|
||||
FCT-Quoted.FCTQuotedEmpty =
|
||||
|
||||
lexical syntax
|
||||
INT = "-"? [0-9]+
|
||||
FLOAT = "-"? [0-9]+ "." [0-9]+
|
||||
CHAR = "'" ~[] "'"
|
||||
STRING = "\"" STRING-CHAR* "\""
|
||||
STRING-CHAR = ~[\"\n] | "\\\"" | BACKSLASH
|
||||
BACKSLASH = "\\"
|
||||
NAME = [a-z] [a-zA-Z0-9\-]*
|
||||
VAR = [A-Z] [a-zA-Z]* ([\-] [a-zA-Z]+)* SUFFIX? POSTFIX?
|
||||
SUFFIX = [0-9]+ | [\']+ | ([0-9]+ [\']+)
|
||||
POSTFIX = "*" | "+" | "?"
|
||||
|
||||
LAYOUT = [\ \t\n\r]
|
||||
LAYOUT = "/*" (~[\*] | STAR)* "*/"
|
||||
STAR = "*"
|
||||
LAYOUT = "//" ~[\n\r]* ([\n\r] | EOF)
|
||||
EOF =
|
||||
|
||||
lexical restrictions
|
||||
INT -/- [0-9]
|
||||
FLOAT -/- [0-9]
|
||||
NAME -/- [a-zA-Z0-9\-]
|
||||
BACKSLASH -/- [\"]
|
||||
STAR -/- [\/]
|
||||
EOF -/- ~[]
|
||||
|
||||
context-free restrictions
|
||||
LAYOUT? -/- [\ \t\n\r]
|
||||
LAYOUT? -/- [\/].[\/]
|
||||
LAYOUT? -/- [\/].[\*]
|
||||
12
IBAF-Editor/syntax/IBAF.sdf3
Normal file
12
IBAF-Editor/syntax/IBAF.sdf3
Normal file
@@ -0,0 +1,12 @@
|
||||
module IBAF
|
||||
|
||||
imports
|
||||
IBAF-Start
|
||||
|
||||
context-free start-symbols
|
||||
|
||||
Start
|
||||
|
||||
context-free syntax
|
||||
|
||||
Start = L-start
|
||||
11
IBAF-Editor/syntax/Stratego-IBAF.sdf
Normal file
11
IBAF-Editor/syntax/Stratego-IBAF.sdf
Normal file
@@ -0,0 +1,11 @@
|
||||
module Stratego-IBAF
|
||||
|
||||
imports
|
||||
Stratego
|
||||
IBAF
|
||||
exports context-free syntax
|
||||
Module -> Start
|
||||
"|[" FCT-SEQ "]|" -> Term {cons("ToTerm"),prefer}
|
||||
|
||||
variables
|
||||
"START" -> L-start {prefer}
|
||||
72
IBAF-Editor/syntax/cbs-gen/IBAF-Start.sdf3
Normal file
72
IBAF-Editor/syntax/cbs-gen/IBAF-Start.sdf3
Normal file
@@ -0,0 +1,72 @@
|
||||
module IBAF-Start
|
||||
|
||||
imports
|
||||
|
||||
Funcons
|
||||
|
||||
// Language "IBAFlang"
|
||||
|
||||
lexical syntax // Language
|
||||
LEX-int = ( [0-9] )+
|
||||
LEX-id = ( [a-z] ) ( [a-z] | [0-9] )*
|
||||
|
||||
syntax // Language
|
||||
|
||||
context-free syntax // Language
|
||||
L-start.L-start--L-exp =
|
||||
L-exp
|
||||
|
||||
L-exp.L-exp--L-int =
|
||||
L-int
|
||||
L-exp.L-exp--L-id =
|
||||
L-id
|
||||
L-exp.L-exp--R-lambda-L-id-DOT-L-exp =
|
||||
"lambda" L-id "." L-exp
|
||||
L-exp.L-exp--L-exp-LPAREN-L-exp-RPAREN =
|
||||
L-exp "(" L-exp ")"
|
||||
L-exp.L-exp--R-let-L-id-EQUALS-L-exp-R-in-L-exp =
|
||||
"let" L-id "=" L-exp "in" L-exp
|
||||
L-exp.L-exp--LPAREN-L-exp-RPAREN =
|
||||
"(" L-exp ")"
|
||||
|
||||
L-int.LEX-int =
|
||||
LEX-int
|
||||
L-id.LEX-id =
|
||||
LEX-id
|
||||
|
||||
context-free syntax // Semantics
|
||||
FCT.T-start =
|
||||
"start" "[:" L-start ":]"
|
||||
FCT.T-eval =
|
||||
"eval" "[:" L-exp ":]"
|
||||
FCT-Quoted.L-int = L-int
|
||||
FCT.T-int =
|
||||
"int" "[:" L-int ":]"
|
||||
FCT-Quoted.L-id = L-id
|
||||
FCT.T-id =
|
||||
"id" "[:" L-id ":]"
|
||||
|
||||
context-free syntax // Desugaring
|
||||
|
||||
variables // Meta-variables
|
||||
L-start = "(:START" [1-9]? ":)" {prefer}
|
||||
L-start? = "(:START" [1-9]? "?:)" {prefer}
|
||||
L-start* = "(:START" [1-9]? "*:)" {prefer}
|
||||
L-start+ = "(:START" [1-9]? "+:)" {prefer}
|
||||
L-exp = "(:E" [1-9]? ":)" {prefer}
|
||||
L-exp? = "(:E" [1-9]? "?:)" {prefer}
|
||||
L-exp* = "(:E" [1-9]? "*:)" {prefer}
|
||||
L-exp+ = "(:E" [1-9]? "+:)" {prefer}
|
||||
L-int = "(:N" [1-9]? ":)" {prefer}
|
||||
L-int? = "(:N" [1-9]? "?:)" {prefer}
|
||||
L-int* = "(:N" [1-9]? "*:)" {prefer}
|
||||
L-int+ = "(:N" [1-9]? "+:)" {prefer}
|
||||
L-id = "(:X" [1-9]? ":)" {prefer}
|
||||
L-id? = "(:X" [1-9]? "?:)" {prefer}
|
||||
L-id* = "(:X" [1-9]? "*:)" {prefer}
|
||||
L-id+ = "(:X" [1-9]? "+:)" {prefer}
|
||||
|
||||
// SDF comments
|
||||
|
||||
sorts // ASTs
|
||||
T-start
|
||||
Reference in New Issue
Block a user