Name Date Size

..29-Nov-20194 KiB

.gitignoreH A D10-Nov-2019393

allocate.cH A D30-Sep-20194.7 KiB

allocate.hH A D30-Sep-20192.7 KiB

ast-inspect.cH A D04-Nov-20196.7 KiB

ast-inspect.hH A D23-Nov-2017330

ast-model.cH A D23-Nov-201714.4 KiB

ast-model.hH A D23-Nov-20172.2 KiB

ast-view.cH A D23-Nov-20171.1 KiB

ast-view.hH A D23-Nov-201795

bitmap.hH A D23-Nov-20171.4 KiB

bits.hH A D14-Nov-20181.2 KiB

builtin.cH A D03-Oct-201926.5 KiB

c2xml.cH A D14-Nov-20187.7 KiB

cgccH A D22-Jan-202011.2 KiB

cgcc.1H A D23-Nov-20171 KiB

char.cH A D17-Dec-20183.2 KiB

char.hH A D23-Nov-2017148

compat/H23-Nov-20174 KiB

compat-bsd.cH A D23-Nov-20171.3 KiB

compat-cygwin.cH A D23-Nov-20171.7 KiB

compat-linux.cH A D23-Nov-2017119

compat-mingw.cH A D23-Nov-20171.6 KiB

compat-solaris.cH A D23-Nov-2017685

compat.hH A D20-Dec-2018685

compile-i386.cH A D14-Nov-201854.8 KiB

compile.cH A D14-Nov-20182.4 KiB

compile.hH A D23-Nov-2017199

cse.cH A D14-Nov-20188.2 KiB

cse.hH A D14-Nov-2018176

ctags.cH A D14-Nov-20185.6 KiB

dissect.cH A D30-Sep-201914.2 KiB

dissect.hH A D23-Nov-2017563

Documentation/H14-Oct-20194 KiB

dominate.cH A D14-Nov-20183.4 KiB

dominate.hH A D14-Nov-2018258

evaluate.cH A D17-Dec-201994.7 KiB

evaluate.hH A D14-Nov-2018721

example.cH A D14-Nov-201844 KiB

expand.cH A D17-Dec-201932.6 KiB

expand.hH A D23-Nov-20171.5 KiB

expression.cH A D30-Sep-201924.5 KiB

expression.hH A D30-Sep-20198.6 KiB

FAQH A D23-Nov-20173.3 KiB

flow.cH A D14-Nov-201818.7 KiB

flow.hH A D14-Nov-20181.5 KiB

flowgraph.cH A D14-Nov-20184.7 KiB

flowgraph.hH A D14-Nov-2018266

gcc-attr-list.hH A D28-Mar-20194.4 KiB

gdbhelpersH A D28-Nov-20195.1 KiB

graph.cH A D14-Nov-20185.7 KiB

gvpr/H23-Nov-20174 KiB

ident-list.hH A D14-Nov-20182.1 KiB

inline.cH A D30-Sep-201915.4 KiB

ir.cH A D14-Nov-20184 KiB

ir.hH A D14-Nov-2018101

lib.cH A D22-Jan-202039.8 KiB

lib.hH A D22-Jan-20209.5 KiB

LICENSEH A D23-Nov-20171.5 KiB

linearize.cH A D30-Sep-201963.2 KiB

linearize.hH A D30-Sep-20197.8 KiB

liveness.cH A D30-Sep-20197.2 KiB

liveness.hH A D14-Nov-2018227

machine.hH A D22-Jan-20202.7 KiB

MakefileH A D22-Jan-20206.9 KiB

memops.cH A D17-Dec-20195.3 KiB

obfuscate.cH A D14-Nov-20182.2 KiB

opcode.cH A D14-Nov-20181.4 KiB

opcode.defH A D14-Nov-20185.8 KiB

opcode.hH A D14-Nov-2018649

optimize.cH A D14-Nov-20182.4 KiB

optimize.hH A D14-Nov-2018122

parse.cH A D09-Dec-201984.5 KiB

parse.dtdH A D23-Nov-20171.6 KiB

parse.hH A D30-Sep-20194.2 KiB

pre-process.cH A D22-Jan-202053.1 KiB

ptrlist.cH A D12-Jan-202010.4 KiB

ptrlist.hH A D19-Nov-20188.7 KiB

ptrmap.cH A D14-Nov-20182.6 KiB

ptrmap.hH A D14-Nov-2018865

READMEH A D14-Nov-20182.9 KiB

scope.cH A D23-Nov-20173.5 KiB

scope.hH A D14-Nov-20181.9 KiB

show-parse.cH A D16-Jan-202027.7 KiB

simplify.cH A D22-Dec-201840.9 KiB

sort.cH A D14-Nov-20185.6 KiB

sparse-llvm-disH A D14-Nov-2018271

sparse-llvm.cH A D14-Nov-201831.6 KiB

sparse.1H A D12-Nov-201917.1 KiB

sparse.cH A D29-Nov-20188.3 KiB

sparsecH A D13-Oct-2019958

sparseiH A D23-Nov-2018404

ssa.cH A D14-Nov-20188.6 KiB

ssa.hH A D14-Nov-201898

sset.cH A D14-Nov-2018578

sset.hH A D14-Nov-20181.1 KiB

stats.cH A D23-Nov-20171.7 KiB

storage.cH A D23-Nov-20177.4 KiB

storage.hH A D23-Nov-20171.7 KiB

symbol.cH A D17-Dec-201923.4 KiB

symbol.hH A D22-Jan-202014.6 KiB

target-arm.cH A D22-Jan-2020644

target-arm64.cH A D22-Jan-2020752

target-default.cH A D22-Jan-2020190

target-m68k.cH A D22-Jan-2020382

target-mips.cH A D22-Jan-20201 KiB

target-ppc.cH A D22-Jan-20201.1 KiB

target-riscv.cH A D22-Jan-20201 KiB

target-s390.cH A D22-Jan-2020819

target-sparc.cH A D22-Jan-20201.2 KiB

target-x86.cH A D23-Jan-20201.3 KiB

target.cH A D22-Jan-20204.4 KiB

target.hH A D22-Jan-20202.8 KiB

test-dissect.cH A D14-Nov-20182.1 KiB

test-inspect.cH A D14-Nov-2018854

test-lexing.cH A D14-Nov-20181.7 KiB

test-linearize.cH A D14-Nov-20182 KiB

test-parsing.cH A D14-Nov-20182.4 KiB

test-show-type.cH A D10-Nov-2019512

test-sort.cH A D23-Nov-2017852

test-unssa.cH A D14-Nov-20181.7 KiB

token.hH A D14-Nov-20186.2 KiB

tokenize.cH A D14-Dec-201823 KiB

unssa.cH A D14-Nov-20183.5 KiB

utils.cH A D14-Nov-2018715

utils.hH A D14-Nov-20181.2 KiB

validation/H17-Dec-201920 KiB

README

1
2  sparse (spärs), adj,., spars-er, spars-est.
3	1. thinly scattered or distributed; "a sparse population"
4	2. thin; not thick or dense: "sparse hair"
5	3. scanty; meager.
6	4. semantic parse
7  	[ from Latin: spars(us) scattered, past participle of
8	  spargere 'to sparge' ]
9
10	Antonym: abundant
11
12Sparse is a semantic parser of source files: it's neither a compiler
13(although it could be used as a front-end for one) nor is it a
14preprocessor (although it contains as a part of it a preprocessing
15phase). 
16
17It is meant to be a small - and simple - library.  Scanty and meager,
18and partly because of that easy to use.  It has one mission in life:
19create a semantic parse tree for some arbitrary user for further
20analysis.  It's not a tokenizer, nor is it some generic context-free
21parser.  In fact, context (semantics) is what it's all about - figuring
22out not just what the grouping of tokens are, but what the _types_ are
23that the grouping implies.
24
25And no, it doesn't use lex and yacc (or flex and bison).  In my personal
26opinion, the result of using lex/yacc tends to end up just having to
27fight the assumptions the tools make. 
28
29The parsing is done in five phases:
30
31 - full-file tokenization
32 - pre-processing (which can cause another tokenization phase of another
33   file)
34 - semantic parsing.
35 - lazy type evaluation
36 - inline function expansion and tree simplification
37
38Note the "full file" part. Partly for efficiency, but mostly for ease of
39use, there are no "partial results". The library completely parses one
40whole source file, and builds up the _complete_ parse tree in memory.
41
42Also note the "lazy" in the type evaluation.  The semantic parsing
43itself will know which symbols are typedefines (required for parsing C
44correctly), but it will not have calculated what the details of the
45different types are.  That will be done only on demand, as the back-end
46requires the information. 
47
48This means that a user of the library will literally just need to do
49
50  struct string_list *filelist = NULL;
51  char *file;
52
53  action(sparse_initialize(argc, argv, filelist));
54
55  FOR_EACH_PTR(filelist, file) {
56    action(sparse(file));
57  } END_FOR_EACH_PTR(file);
58
59and he is now done - having a full C parse of the file he opened.  The
60library doesn't need any more setup, and once done does not impose any
61more requirements.  The user is free to do whatever he wants with the
62parse tree that got built up, and needs not worry about the library ever
63again.  There is no extra state, there are no parser callbacks, there is
64only the parse tree that is described by the header files. The action
65funtion takes a pointer to a symbol_list and does whatever it likes with it.
66
67The library also contains (as an example user) a few clients that do the
68preprocessing, parsing and type evaluation and just print out the
69results.  These clients were done to verify and debug the library, and
70also as trivial examples of what you can do with the parse tree once it
71is formed, so that users can see how the tree is organized. 
72