cbc/test/syntax1.cb

90 lines
1.1 KiB
Plaintext

// various syntaxes
// line comment
// line comment-----
/* block comment */
/* block
comment in
multiple lines */
import stdio;
import stdlib;
import unistd;
char c;
short s;
int ii;
long l;
unsigned char uc;
unsigned short us;
unsigned int ui;
unsigned long ul;
int* p;
int** pp;
int*** ppp;
int**** pppp;
int***** ppppp;
int[1] a;
int[1][1] aa;
int[1][1][1] aaa;
int*[1] pa;
int[]* ap;
int**[1] ppa;
int*[]* pap;
int[]** app;
int[1][1]* aap;
int[]*[1] apa;
int*[1][1] paa;
struct file {
int fd;
char *path;
};
struct ifnode {
union node *cond;
union node *then_body;
union node *else_body;
};
struct stmt {
union node *expr;
};
union node {
struct ifnode ifnode;
struct stmt stmt;
};
typedef int myint;
int
main(int argc, char** argv)
{
ff();
return f(1, 2, 3);
}
void ff(void) { return; }
int
f(int i, int j, int k)
{
i++;
++i;
i--;
--i;
printf("%d, %d, %d\n", 1, *(int*)&j, (int)h());
return g(g(i, j % 18), 3 + 5 * 7);
}
int g(int i, int j) {
;; return i * h() * *(myint*)&j ; }
myint h(void) { return 0; }