google / google/xls

Simplify DSLX proc syntax

Open
#836 2 comments 0 reactions 0 assignees View on GitHub
dslx enhancement
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Example of curent syntax

```
pub proc foo {
in_ch: chan in;
out_ch: chan out;

init { () }

config (i: chan in, o: chan out) {
let (a_in, a_out) = chan;
spawn bar(a_in);
spawn qux(a_out);
(i, o)
}

next(tok: token, state: ()) {
// use in_ch and out_ch
}
}
```

There is a fair amount of replication and boiler plate in the config. One alternative might be to have the proc config arguments defined by the proc name kind of like a function. The config could even be folded up into the proc body. Maybe something like:

```
pub proc foo(in_ch: chan in, out_ch: chan out) {
let a = chan;
spawn bar(a.in);
spawn qux(a.out);

init { () }

next(tok: token, state: ()) {
// use in_ch and out_ch
}
}
```

This example uses #830 in which channels declarations produce structs with in and out members,

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.