You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The process language and type system was designed to keep the burden of where/when splitting tensors & pars really low.
Channel splitting
This means that channel splittings can be done early and freely ordered.
However we could directly name the sessions deeply and automate these splittings.
Example:
pattern_example = proc[ a : !Int, [: b : !Int, c : !Int :], { d : [!Int, !Int], e : {?Int, ?Int} } ]
(send a 1 | send b 2. send c 3 | fwd [!Int,!Int] (d,e))
Which should desugar to:
pattern_example_expanded =
proc(abcde : [!Int, [: !Int, !Int :], { [!Int, !Int], {?Int, ?Int} } ])
abcde[a, bc, de]
bc[: b, c :]
de{d, e}
(send a 1 | send b 2. send c 3 | fwd [!Int,!Int] (d,e))
Splitting patterns are not only for processes-as-terms but should be allowed for normal splitting as well:
pattern_example_2 = proc(abcde)
abcde[ a : !Int, [: b, c :], { d, e } ]
(send a 1 | send b 2. send c 3 | fwd [!Int,!Int] (d,e))
This example also recalls that session annotations are optional.
When injecting a term as a process one must pass in some channels.
For instance consider we want to inject the term above in another process where the protocol is equivalent up-to some permutations.
-- notice how various parts gets commuted
test_pat =
proc[ [: b : !Int, c : !Int :], a : !Int, { e : {?Int, ?Int}, d : [!Int, !Int] } ]
@pattern_example[a, [: b, c :], {d, e}]
These grouping patterns can be expanded away as well. While we need to have this expansion in place eventually it is better to check the process un-expanded.
The expansion of grouping patterns for our example is:
test_pat_expanded_grouping =
proc[ [: b : !Int, c : !Int :], a : !Int, { e : {?Int, ?Int}, d : [!Int, !Int] } ]
new(f, g)
( @pattern_example(f)
| g[a, [: b, c :], {d, e}])
So expansion of grouping patterns rely on the expansion of splitting patterns.
Related to #7
Either deep patterns are expanded away to shallow patterns
or we need to support deep patterns in:
* Check.Core
* Compile.C
* Fuse
* Sequential
The process language and type system was designed to keep the burden of where/when splitting tensors & pars really low.
Channel splitting
This means that channel splittings can be done early and freely ordered.
However we could directly name the sessions deeply and automate these splittings.
Example:
Which should desugar to:
Splitting patterns are not only for processes-as-terms but should be allowed for normal splitting as well:
This example also recalls that session annotations are optional.
Patterns for grouping
[Grouping has been implemented in commit 72a3388]
When injecting a term as a process one must pass in some channels.
For instance consider we want to inject the term above in another process where the protocol is equivalent up-to some permutations.
Alternatively with pattern splitting expanded:
These grouping patterns can be expanded away as well. While we need to have this expansion in place eventually it is better to check the process un-expanded.
The expansion of grouping patterns for our example is:
So expansion of grouping patterns rely on the expansion of splitting patterns.
Syntax of Patterns
[also in commit 72a3388]
After the keyword
proc
we change `"(" ChanDecs ")", into TopPatt.Implementation sketch
The text was updated successfully, but these errors were encountered: