Updates to grammar.

This commit is contained in:
Christoffer Lerno
2025-02-09 02:19:27 +01:00
parent e1d546225f
commit ce06de4b18
2 changed files with 37 additions and 5 deletions

View File

@@ -1,4 +1,23 @@
for fn in `find ../../../c3c -name '*.c3' | sort`
echo "Testing lib"
for fn in `find ../../../c3c/lib -name '*.c3' | sort`
do
echo -n $fn
cat $fn | ./c3yacc
done
echo "Testing resources"
for fn in `find ../../../c3c/resources -name '*.c3' | sort`
do
echo -n $fn
cat $fn | ./c3yacc
done
echo "Testing unit tests"
for fn in `find ../../../c3c/test/unit -name '*.c3' | sort`
do
echo -n $fn
cat $fn | ./c3yacc
done
echo "Testing compiler tests"
for fn in `find ../../../c3c/test/test_suite -name '*.c3t' | sort`
do
echo -n $fn
cat $fn | ./c3yacc

View File

@@ -557,8 +557,10 @@ type
| type '[' constant_expr ']'
| type '[' ']'
| type '[' '*' ']'
| type '[' '?' ']'
| type LVEC constant_expr RVEC
| type LVEC '*' RVEC
| type LVEC '?' RVEC
;
optional_type
@@ -1094,6 +1096,7 @@ fn_parameter_list
parameter_default
: parameter
| parameter '=' expr
| parameter '=' type
;
parameters
@@ -1131,8 +1134,8 @@ func_definition
const_declaration
: CONST CONST_IDENT opt_attributes '=' expr ';'
| CONST type CONST_IDENT opt_attributes '=' expr ';'
| CONST type CONST_IDENT opt_attributes ';'
| CONST optional_type CONST_IDENT opt_attributes '=' expr ';'
| CONST optional_type CONST_IDENT opt_attributes ';'
;
func_typedef
@@ -1204,8 +1207,18 @@ interface_body
;
interface_declaration
: INTERFACE TYPE_IDENT '{' '}'
| INTERFACE TYPE_IDENT '{' interface_body '}'
: INTERFACE interface_declaration_name '{' '}'
| INTERFACE interface_declaration_name '{' interface_body '}'
;
interface_parents
: TYPE_IDENT
| interface_parents ',' TYPE_IDENT
;
interface_declaration_name
: TYPE_IDENT
| TYPE_IDENT ':' interface_parents
;
distinct_declaration