Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision |
language:langs:chp [2023/04/07 12:20] – [Syntactic replication] rajit | language:langs:chp [2023/04/09 23:26] – [Conditional execution] rajit |
---|
| |
In the published literature, non-deterministic selections are usually written using a thin bar ''|'' rather than the thick bar ''[]''. However, this can create some ambiguities in parsing. For example, consider the statement ''[ a -> y:=b | c | d -> skip ]''. This can be parsed in a number of ways, and it is not clear which one was the intended option. | In the published literature, non-deterministic selections are usually written using a thin bar ''|'' rather than the thick bar ''[]''. However, this can create some ambiguities in parsing. For example, consider the statement ''[ a -> y:=b | c | d -> skip ]''. This can be parsed in a number of ways, and it is not clear which one was the intended option. |
| |
| ===== Arrays: dynamic v/s non-dynamic indices ===== |
| |
| Suppose an array ''x'' has been declared as: |
| <code act> |
| int x[10]; |
| </code> |
| |
| Now when ''x'' is accessed in CHP, it could be accessed with an array index that is a run-time constant, or an index that is computed at run-time. For example, the CHP program |
| <code act> |
| chp { |
| ... |
| x[0] := x[0] + 1; |
| ... |
| } |
| </code> |
| uses ''x'' with a constant index. As opposed to this, the program |
| <code act> |
| chp { |
| ... |
| x[i] := x[i] + 1; |
| ... |
| } |
| </code> |
| uses ''x'' with an index that is computed using the run-time value of ''i''. This second category of arrays are referred to as //dynamic arrays//---not because the array size is dynamic, but because the element of the array accessed depends on a value that is computed by the circuit. |
| |
| |
===== Loops ===== | ===== Loops ===== |