Restricted types of parameters to cartesian types.

This commit is contained in:
Christian Rinderknecht 2019-03-21 15:09:35 +01:00
parent 3b318d0f06
commit fa8adb9bde
No known key found for this signature in database
GPG Key ID: 9446816CFD267040
2 changed files with 19 additions and 4 deletions

View File

@ -462,7 +462,7 @@ and logic_expr =
and bool_expr = and bool_expr =
Or of kwd_or bin_op reg Or of kwd_or bin_op reg
| And of kwd_and bin_op reg | And of kwd_and bin_op reg
| Not of kwd_not un_op reg | Not of kwd_not un_op reg
| False of c_False | False of c_False
| True of c_True | True of c_True

View File

@ -303,7 +303,7 @@ parameters:
par(nsepseq(param_decl,SEMI)) { $1 } par(nsepseq(param_decl,SEMI)) { $1 }
param_decl: param_decl:
Var var COLON type_expr { Var var COLON param_type {
let stop = type_expr_to_region $4 in let stop = type_expr_to_region $4 in
let region = cover $1 stop let region = cover $1 stop
and value = { and value = {
@ -313,7 +313,7 @@ param_decl:
param_type = $4} param_type = $4}
in ParamVar {region; value} in ParamVar {region; value}
} }
| Const var COLON type_expr { | Const var COLON param_type {
let stop = type_expr_to_region $4 in let stop = type_expr_to_region $4 in
let region = cover $1 stop let region = cover $1 stop
and value = { and value = {
@ -330,7 +330,7 @@ entry_param_decl:
ParamConst const -> EntryConst const ParamConst const -> EntryConst const
| ParamVar var -> EntryVar var | ParamVar var -> EntryVar var
} }
| Storage var COLON type_expr { | Storage var COLON param_type {
let stop = type_expr_to_region $4 in let stop = type_expr_to_region $4 in
let region = cover $1 stop let region = cover $1 stop
and value = { and value = {
@ -341,6 +341,21 @@ entry_param_decl:
in EntryStore {region; value} in EntryStore {region; value}
} }
param_type:
nsepseq(core_param_type,TIMES) {
let region = nsepseq_to_region type_expr_to_region $1
in TProd {region; value=$1}
}
core_param_type:
type_name {
TAlias $1
}
| type_name type_tuple {
let region = cover $1.region $2.region
in TApp {region; value = $1,$2}
}
block: block:
Begin series(instruction) { Begin series(instruction) {
let first, (others, terminator, close) = $2 in let first, (others, terminator, close) = $2 in