Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
language:langs:chp [2022/05/13 08:48]
rajit
language:langs:chp [2022/08/02 16:24]
rajit
Line 173: Line 173:
 </code> </code>
  
 +==== Functions in expressions ====
 +
 +The CHP language supports functions in expressions. These  functions can be templated, and must operate on ''int'' or ''bool'' arguments (no array arguments at present). The syntax for functions can be found with general rules for [[language:expressions|expressions]].
 ==== More on channel expressions and probes ==== ==== More on channel expressions and probes ====
  
Line 229: Line 232:
  
 Four-phase handshake channels involve two synchronizations. If you need to make this explicit in the CHP, the ''!'' (send) and ''?'' (receive) operators can be replaced with ''!+'' (first half of send), ''!-'' (second half of send), or ''?+'' (first half of receive), ''?-'' (second half of receive). The second half is purely synchronization and should not have any data. Four-phase handshake channels involve two synchronizations. If you need to make this explicit in the CHP, the ''!'' (send) and ''?'' (receive) operators can be replaced with ''!+'' (first half of send), ''!-'' (second half of send), or ''?+'' (first half of receive), ''?-'' (second half of receive). The second half is purely synchronization and should not have any data.
 +
 +==== The chp-txt sublanguage ====
 +
 +Since the CHP syntax is quite different from commonly used programming languages, we have provided a variation called ''chp-txt'' that uses notation that may be a bit more familiar to programmers. Note that ''chp-txt'' is viewed internally as exactly the same as ''chp'', so only one ''chp''/''chp-txt'' block can be used in a process.
 +<code act>
 +chp-txt { 
 +   /* chp-txt program goes here */
 +}
 +</code>
 +The basic statements, expression syntax, etc. remains unchanged from the CHP language. What is different is the syntax for loops, selection statements, and short-cuts.