2 * Example trivial client program that uses the sparse library
3 * to tokenize, pre-process and parse a C file, and prints out
6 * Copyright (C) 2003 Linus Torvalds, all rights reserved.
21 int main(int argc
, char **argv
)
23 int fd
= open(argv
[1], O_RDONLY
);
25 struct symbol_list
*list
= NULL
;
28 die("No such file: %s", argv
[1]);
31 // Tokenize the input stream
32 token
= tokenize(argv
[1], fd
, NULL
);
35 // Pre-process the stream
36 token
= preprocess(token
);
38 // Parse the resulting C code
39 translation_unit(token
, &list
);
41 // Show the end result.
42 show_symbol_list(list
, "\n\n");
45 // And show the allocation statistics
49 show_expression_alloc();
50 show_statement_alloc();