| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #include <stdio.h>
- #include <stdlib.h>
- #include "node.h"
- #include "sym.h"
- typedef struct prog {
- char *probe;
- node_t *ast;
- symtab_t locals;
- symtab_t *globals;
- } prog_t;
- symtab_t globals = { .sym = NULL, .len = 0 };
- prog_t *prog_get(void)
- {
- prog_t *p;
- p = calloc(1, sizeof(*p));
- p->globals = &globals,
- /* reads{pid()} @ quantize(arg2) */
- p->ast =
- node_expr('@',
- node_cons(
- node_expr('m',
- node_cons(
- node_ident("reads"),
- node_expr('(', node_ident("pid"))
- )
- ),
- node_expr('(',
- node_cons(
- node_ident("quantize"),
- node_ident("arg2")
- )
- )
- )
- );
- return p;
- }
- int main(void)
- {
- node_dump_info_t info = {
- .indent = 2,
- .fp = stdout,
- };
- prog_t *p = prog_get();
- node_dump(p->ast, &info);
- return 0;
- }
|