Name Date Size

..05-Sep-20204 KiB

.gitignoreH A D05-Aug-2020400

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 D12-Sep-202023.3 KiB

builtin.hH A D13-Jun-2020245

c2xml.cH A D14-Nov-20187.7 KiB

cgccH A D18-Jul-202010.5 KiB

cgcc.1H A D23-Nov-20171 KiB

char.cH A D10-Aug-20203.3 KiB

char.hH A D23-Nov-2017148

compat/H23-Nov-20174 KiB

compat-bsd.cH A D05-Jul-20201.1 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 D05-Jul-202026

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-Jul-202015.2 KiB

dissect.hH A D20-Feb-2020759

Documentation/H12-Sep-20204 KiB

dominate.cH A D14-Nov-20183.4 KiB

dominate.hH A D14-Nov-2018258

evaluate.cH A D18-Aug-202098.3 KiB

evaluate.hH A D09-Aug-2020973

example.cH A D14-Nov-201844 KiB

expand.cH A D14-Aug-202032.6 KiB

expand.hH A D23-Nov-20171.5 KiB

expression.cH A D18-Jul-202026 KiB

expression.hH A D28-Jul-20208.9 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 D29-Jan-20204.8 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 D21-Jun-20202.1 KiB

inline.cH A D25-Jul-202015.5 KiB

ir.cH A D14-Nov-20184 KiB

ir.hH A D14-Nov-2018101

lib.cH A D09-Aug-202011.5 KiB

lib.hH A D01-Aug-20206.9 KiB

LICENSEH A D23-Nov-20171.5 KiB

linearize.cH A D12-Sep-202066.1 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 D18-Jul-20202.9 KiB

MakefileH A D12-Sep-20207.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 D12-Sep-20205.9 KiB

opcode.hH A D14-Nov-2018649

optimize.cH A D18-Jun-20202.3 KiB

optimize.hH A D14-Nov-2018122

options.cH A D18-Aug-202023.5 KiB

options.hH A D18-Aug-20203.2 KiB

parse.cH A D18-Aug-202083.2 KiB

parse.dtdH A D23-Nov-20171.6 KiB

parse.hH A D06-Jul-20204.4 KiB

pre-process.cH A D01-Aug-202055.2 KiB

predefine.cH A D18-Jul-20208.9 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 D21-May-20204.1 KiB

scope.hH A D21-May-20202.1 KiB

semind.1H A D05-Aug-20202.9 KiB

semind.cH A D05-Aug-202028.2 KiB

show-parse.cH A D10-Aug-202028.2 KiB

simplify.cH A D12-Sep-202040.5 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 D18-Aug-202018.5 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 D10-Aug-202024.8 KiB

symbol.hH A D14-Aug-202015.6 KiB

target-alpha.cH A D18-Jul-2020986

target-arm.cH A D18-Jul-20201.1 KiB

target-arm64.cH A D18-Jul-2020847

target-bfin.cH A D13-Jun-2020563

target-default.cH A D22-Jan-2020190

target-h8300.cH A D18-Jul-2020663

target-m68k.cH A D18-Jul-2020572

target-microblaze.cH A D18-Jul-2020697

target-mips.cH A D18-Jul-20201.2 KiB

target-nds32.cH A D18-Jul-2020640

target-nios2.cH A D18-Jul-20201.1 KiB

target-openrisc.cH A D18-Jul-2020582

target-ppc.cH A D18-Jul-20201.6 KiB

target-riscv.cH A D18-Jul-20203.8 KiB

target-s390.cH A D18-Jul-20201.3 KiB

target-sh.cH A D18-Jul-2020666

target-sparc.cH A D18-Jul-20201.6 KiB

target-x86.cH A D18-Jul-20203.2 KiB

target-xtensa.cH A D28-Jul-2020583

target.cH A D18-Jul-20206.5 KiB

target.hH A D18-Jul-20204.1 KiB

test-dissect.cH A D20-Feb-20202.7 KiB

test-inspect.cH A D05-Jul-2020899

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 D22-Jul-20206.5 KiB

tokenize.cH A D10-Aug-202023.2 KiB

unssa.cH A D14-Nov-20183.5 KiB

utils.cH A D06-Jul-2020956

utils.hH A D06-Jul-20201.3 KiB

validation/H14-Aug-202020 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