add parameters to functions
This commit is contained in:
@@ -66,11 +66,18 @@ context-free syntax // Language
|
||||
L-exp "<=" L-exp
|
||||
L-exp.L-exp--L-exp-LESS-L-exp =
|
||||
L-exp "<" L-exp
|
||||
L-exp.L-exp--L-id-LPAREN-RPAREN =
|
||||
L-id "(" ")"
|
||||
L-exp.L-exp--L-id-LPAREN-L-paramvalues-Q-RPAREN =
|
||||
L-id "(" L-paramvalues? ")"
|
||||
L-exp.L-exp--LPAREN-L-exp-RPAREN =
|
||||
"(" L-exp ")"
|
||||
|
||||
L-paramvalues.L-paramvalues--L-exp-C-COMMA-L-paramvalues-D-Q =
|
||||
L-exp L-COMMA-L-paramvalues?
|
||||
|
||||
L-COMMA-L-paramvalues.L-COMMA-L-paramvalues--COMMA-L-paramvalues =
|
||||
"," L-paramvalues
|
||||
|
||||
|
||||
L-id.LEX-id =
|
||||
LEX-id
|
||||
L-decimal.LEX-decimal =
|
||||
@@ -83,6 +90,8 @@ context-free syntax // Semantics
|
||||
|
||||
FCT.T-eval-exp =
|
||||
"eval-exp" "[:" L-exp ":]"
|
||||
FCT.T-eval-params =
|
||||
"eval-params" "[:" L-paramvalues? ":]"
|
||||
FCT-Quoted.L-id = L-id
|
||||
FCT.T-id =
|
||||
"id" "[:" L-id ":]"
|
||||
@@ -107,6 +116,10 @@ variables // Meta-variables
|
||||
L-exp? = "(:Exp" [1-9]? "?:)" {prefer}
|
||||
L-exp* = "(:Exp" [1-9]? "*:)" {prefer}
|
||||
L-exp+ = "(:Exp" [1-9]? "+:)" {prefer}
|
||||
L-paramvalues = "(:ParamValues" [1-9]? ":)" {prefer}
|
||||
L-paramvalues? = "(:ParamValues" [1-9]? "?:)" {prefer}
|
||||
L-paramvalues* = "(:ParamValues" [1-9]? "*:)" {prefer}
|
||||
L-paramvalues+ = "(:ParamValues" [1-9]? "+:)" {prefer}
|
||||
L-id = "(:Id" [1-9]? ":)" {prefer}
|
||||
L-id? = "(:Id" [1-9]? "?:)" {prefer}
|
||||
L-id* = "(:Id" [1-9]? "*:)" {prefer}
|
||||
|
||||
@@ -12,6 +12,10 @@ lexical syntax // Language
|
||||
|
||||
|
||||
|
||||
// # Handling parameter declarations
|
||||
|
||||
|
||||
|
||||
// # Handling variable declarations
|
||||
|
||||
|
||||
@@ -22,6 +26,10 @@ syntax // Language
|
||||
|
||||
|
||||
|
||||
// # Handling parameter declarations
|
||||
|
||||
|
||||
|
||||
// # Handling variable declarations
|
||||
|
||||
|
||||
@@ -35,14 +43,27 @@ context-free syntax // Language
|
||||
"{" L-statement* "}"
|
||||
L-statement.L-statement--R-print-LPAREN-L-exp-RPAREN-SEMI =
|
||||
"print" "(" L-exp ")" ";"
|
||||
L-statement.L-statement--L-id-SEMI =
|
||||
L-id ";"
|
||||
L-statement.L-statement--R-int-L-id-SEMI =
|
||||
"int" L-id ";"
|
||||
L-statement.L-statement--L-id-EQUALS-L-exp-SEMI =
|
||||
L-id "=" L-exp ";"
|
||||
L-statement.L-statement--R-int-L-id-EQUALS-L-exp-SEMI =
|
||||
"int" L-id "=" L-exp ";"
|
||||
L-statement.L-statement--R-return-L-exp-Q-SEMI =
|
||||
"return" L-exp? ";"
|
||||
L-statement.L-statement--R-fun-L-id-LPAREN-RPAREN-LBRACE-L-statement-S-RBRACE =
|
||||
"fun" L-id "(" ")" "{" L-statement* "}"
|
||||
L-statement.L-statement--R-fun-L-id-LPAREN-L-params-RPAREN-LBRACE-L-statement-S-RBRACE =
|
||||
"fun" L-id "(" L-params ")" "{" L-statement* "}"
|
||||
|
||||
L-params.L-params--L-id-C-COMMA-L-params-D-Q =
|
||||
L-id L-COMMA-L-params?
|
||||
|
||||
L-COMMA-L-params.L-COMMA-L-params--COMMA-L-params =
|
||||
"," L-params
|
||||
|
||||
|
||||
|
||||
// # Handling parameter declarations
|
||||
|
||||
|
||||
|
||||
// # Handling variable declarations
|
||||
@@ -57,6 +78,12 @@ context-free syntax // Semantics
|
||||
FCT.T-execute =
|
||||
"execute" "[:" L-statement* ":]"
|
||||
|
||||
// # Handling parameter declarations
|
||||
|
||||
|
||||
FCT-SEQ.T-collect-params =
|
||||
"collect-params" "[:" L-params ":]"
|
||||
|
||||
// # Handling variable declarations
|
||||
|
||||
|
||||
@@ -69,6 +96,10 @@ context-free syntax // Desugaring
|
||||
|
||||
|
||||
|
||||
// # Handling parameter declarations
|
||||
|
||||
|
||||
|
||||
// # Handling variable declarations
|
||||
|
||||
|
||||
@@ -84,6 +115,14 @@ variables // Meta-variables
|
||||
L-statement+ = "(:Stmt" [1-9]? "+:)" {prefer}
|
||||
L-statement* = "..." [1-9]? {prefer}
|
||||
L-statement* = "..." [1-9]? {prefer}
|
||||
L-params = "(:Params" [1-9]? ":)" {prefer}
|
||||
L-params? = "(:Params" [1-9]? "?:)" {prefer}
|
||||
L-params* = "(:Params" [1-9]? "*:)" {prefer}
|
||||
L-params+ = "(:Params" [1-9]? "+:)" {prefer}
|
||||
|
||||
// # Handling parameter declarations
|
||||
|
||||
|
||||
|
||||
// # Handling variable declarations
|
||||
|
||||
@@ -95,6 +134,10 @@ variables // Meta-variables
|
||||
|
||||
|
||||
|
||||
// # Handling parameter declarations
|
||||
|
||||
|
||||
|
||||
// # Handling variable declarations
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user