add parameters to functions
This commit is contained in:
@@ -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