Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
guide:start [2023/04/20 11:41] karthi |
guide:start [2023/04/21 13:43] (current) rajit [Referencing a particular language body] |
||
---|---|---|---|
Line 5: | Line 5: | ||
==== Initialization ==== | ==== Initialization ==== | ||
- | Act files are read in automatically when the library is initialized as: | + | Act configuration |
< | < | ||
Act::Init (&argc, &argv); | Act::Init (&argc, &argv); | ||
</ | </ | ||
where '' | where '' | ||
- | When this call is executed, | + | When this call is executed, |
Typically, the next step is to create an '' | Typically, the next step is to create an '' | ||
< | < | ||
Line 16: | Line 16: | ||
a = new Act (argv[1]); | a = new Act (argv[1]); | ||
</ | </ | ||
+ | where '' | ||
==== Referencing a process ==== | ==== Referencing a process ==== | ||
- | Once the act pointer has been created, a process (provided in the command-line arguments) within the file can be accessed and expanded: | + | Once the '' |
< | < | ||
Process *p = a-> | Process *p = a-> | ||
- | p = p-> | + | if (!p-> |
+ | p = p-> | ||
+ | } | ||
</ | </ | ||
+ | In this example, the assumption is that '' | ||
==== Referencing the languages body ==== | ==== Referencing the languages body ==== | ||
Line 32: | Line 34: | ||
lang = p-> | lang = p-> | ||
</ | </ | ||
+ | This provides access to all the sub-languages specified within the process.((The refinement body is processed by the expansion phase, and hence the expanded process will contains the appropriate sub-language bodies after taking the specified number of refinement steps into account. This is why '' | ||
==== Referencing a particular language body ==== | ==== Referencing a particular language body ==== | ||
A language body can be accessed from the languages pointer. For example, for the chp body: | A language body can be accessed from the languages pointer. For example, for the chp body: | ||
- | < | + | < |
act_chp *chp; | act_chp *chp; | ||
chp = lang-> | chp = lang-> | ||
</ | </ | ||
+ | Note that the '' | ||
- | Finally, to get a pointer to the actual object that stores the chp data structure: | + | Finally, to get a pointer to the actual object that stores the CHP data structure: |
< | < | ||
act_chp_lang_t *chp_lang; | act_chp_lang_t *chp_lang; | ||
Line 51: | Line 54: | ||
==== The statement list data structure ==== | ==== The statement list data structure ==== | ||
- | The linked list '' | + | The linked list '' |
- | < | + | < |
act_chp_lang_t *c; // contains the overall chp body | act_chp_lang_t *c; // contains the overall chp body | ||
act_chp_lang_t *stmt; | act_chp_lang_t *stmt; | ||
Line 58: | Line 61: | ||
listitem_t *li; | listitem_t *li; | ||
+ | // if c->type is ACT_CHP_SEMI or ACT_CHP_COMMA | ||
stmt_list = c-> | stmt_list = c-> | ||