comparison doc/compiler.rst @ 299:674789d9ff37

Added a doc
author Windel Bouwman
date Sun, 01 Dec 2013 18:37:23 +0100
parents a6f61e9a9d5c
children 158068af716c
comparison
equal deleted inserted replaced
298:f7c3d38d0a47 299:674789d9ff37
33 20 -> 30 [label="IR-code"] 33 20 -> 30 [label="IR-code"]
34 20 -> 31 [label="IR-code"] 34 20 -> 31 [label="IR-code"]
35 30 -> 40 35 30 -> 40
36 } 36 }
37 37
38
38 IR-code 39 IR-code
39 ------- 40 -------
40 The IR-code is implemented in the ir package. 41 The intermediate representation (IR) of a program de-couples the front end
42 from the backend of the compiler.
41 43
42 .. autoclass:: ir.Module 44 See ir for details about all the available instructions.
43 45
44 .. autoclass:: ir.Function
45
46 .. autoclass:: ir.Block
47
48 .. autoclass:: ir.Statement
49
50 .. autoclass:: ir.Expression
51
52 .. # .. inheritance-diagram:: ir.Statement
53 46
54 C3 Front-end 47 C3 Front-end
55 ------------ 48 ------------
56 49
57 For the front-end a recursive descent parser is created for the c3 language. 50 For the front-end a recursive descent parser is created for the c3 language.
58 This is a subset of the C language with some additional features. 51 This is a subset of the C language with some additional features.
59 52
60 .. graphviz:: 53 .. graphviz::
61 54
62 digraph c3 { 55 digraph c3 {
63 rankdir="LR"
64 1 [label="source text"] 56 1 [label="source text"]
65 10 [label="lexer" ] 57 10 [label="lexer" ]
66 20 [label="parser" ] 58 20 [label="parser" ]
67 30 [label="semantic checks" ] 59 30 [label="semantic checks" ]
68 40 [label="code generation"] 60 40 [label="code generation"]
69 99 [label="IR-code object"] 61 99 [label="IR-code object"]
70 1 -> 20 62 1 -> 10
63 10 -> 20
71 20 -> 30 64 20 -> 30
72 30 -> 40 65 30 -> 40 [label="AST tree"]
73 40 -> 99 66 40 -> 99
74 subgraph rel1 {
75 edge [dir=none]
76 10 -> 20
77 }
78 } 67 }
79 68
80 .. autoclass:: c3.Builder 69 .. autoclass:: c3.Builder
81 70
82 .. autoclass:: c3.Parser 71 .. autoclass:: c3.Parser