Skip to content

Commit 7061b05

Browse files
authored
Double parenthesis isn't allowed in Dana Grammar (#80)
In the Dana grammar, the rule for ⟨fpar-type⟩ is: ``` ⟨fpar-type⟩ ::= ⟨type⟩ | "ref" ⟨data-type⟩ | ⟨data-type⟩ "[" "]" ("[" ⟨int-const⟩ "]")* ``` Thus, in function parameter types, the third choice only allows one empty dimension `[]`, followed by one or more explicitly sized dimensions. Therefore, the following is invalid syntax: ``` def printBoard: board_param as byte[][], n_param as int ``` It should be: ``` def printBoard: board_param as byte[][20], n_param as int ```
1 parent 2850672 commit 7061b05

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dana/programs/N_Queens.dana

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ def main
22

33
var size_main is int
44

5-
def printBoard: board_param as byte[][], n_param as int
5+
def printBoard: board_param as byte[][20], n_param as int
66
var i_pb j_pb is int
77
i_pb := 0
88
loop:
@@ -20,7 +20,7 @@ def main
2020
writeString: "\n"
2121
i_pb := i_pb + 1
2222

23-
def isSafe is byte: board_param as byte[][], row_param col_param n_param as int
23+
def isSafe is byte: board_param as byte[][20], row_param col_param n_param as int
2424
var i_is j_is is int
2525

2626
i_is := 0
@@ -53,7 +53,7 @@ def main
5353

5454
return : true
5555

56-
def solveNQueensUtil is byte: board_param as byte[][], row_param n_param as int
56+
def solveNQueensUtil is byte: board_param as byte[][20], row_param n_param as int
5757
var col_util is int
5858

5959
if row_param = n_param :

0 commit comments

Comments
 (0)