Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
stage-L3-2016
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aliaume Lopez
stage-L3-2016
Commits
7323e3ed
Commit
7323e3ed
authored
Sep 14, 2016
by
Aliaume Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the syntax for let binding
parent
0e471787
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
README.md
README.md
+37
-0
No files found.
README.md
View file @
7323e3ed
...
...
@@ -93,6 +93,43 @@ The trace is not an operator yet, because it can be replaced by link.
Inside a
`SEQ ... END`
bloc the newlines are replaced with sequential composition of the lines (with implicit parenthesis
around each line). The same goes for parallel composition and
`PAR ... END`
.
#### LET construction
In order to define complex circuits it is often needed to build separate subcircuits and use them one or several time
in a bigger expression : this is the only thing that the
`let`
construction does.
The syntax is the following :
```
let NameStartingWithACapitalLetter = regular circuit syntax in
...
let ... = ... in
main circuit definition
```
Note that the variable substitution is done textually, meaning that the circuit is _copied_ into the places of use.
Therefore, if the expression contains free variables, they can be bound differently in each use of the circuit, an
example can illustrate this behaviour :
```
let SingleVariable = :a in
(link b:a for ( b: | SingleVariable)) | (link c:a for SingleVariable . c:)
```
```
(link b:a for ( b: | :a)) | (link c:a for :a . c:)
```
Note that variable can be used inside
`let`
expressions, just like in ocaml :
```
let Variable1 = expr1 in
let Variable2 = expr2 that can contain Variable1 in
...
```
There is no way to express mutually recursive definition with let bindings, as it would mean constructing circuits
with infinite depth.
### Building circuits with the AST direcly
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment