File: DESIGN

package info (click to toggle)
dovecot 1%3A2.2.13-12~deb8u4
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 38,792 kB
  • sloc: ansic: 341,472; sh: 16,920; makefile: 5,393; cpp: 1,474; perl: 265; xml: 44; python: 34; pascal: 27
file content (45 lines) | stat: -rw-r--r-- 2,258 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
The compiler consists of the following stages:

PARSER: sieve-parser.c, sieve-lexer.c
  Parses the scriptfile and produces an abstract syntax tree for it
  (sieve-ast.c).

VALIDATOR: sieve-validator.c
  Performs contextual analysis on the ast produced by the parser. This checks
  for the validity of commands, tests and arguments. Also, the ast is decorated
  with any context data acquired during the process. This context is used by the
  last compiler stage.

GENERATOR: sieve-generator.c
  This last compiler stage uses a visitor pattern to wander through the ast and
  produces sieve byte code (sieve-binary.c).

The resulting (in-memory) binary can be fed to the interpreter for execution:

INTERPRETER: sieve-interpreter.c
  The interpreter executes the byte code and produces a sieve_result object.
  This result is no more than just a collection of actions to be performed.
  During execution, action commands add actions to the result. Duplates and
  conflicts between actions are handled in this execution phase.

RESULT: sieve-result.c sieve-actions.c
  When the result is to be executed, it needs no further checking, as the
  validity of the result was verified during interpretation already. The
  result's actions are executed in a transaction-like atomic manner. If one of
  the actions fails, the whole transaction is rolled back meaning that either
  everything succeeds or everything fails. This is only possible to some extent:
  transmitted responses can of course not be rolled back. However, these are
  executed in the commit phase, meaning that they will only be performed if all
  other actions were successful.

Debugging:

BINARY-DUMPER: sieve-code-dumper.c sieve-binary-dumper.c
  A loaded binary can be dumped to a stream in human-readable form using the
  binary-dumper. The binary-dumper displays information on all the blocks that
  the binary consists off. Program code blocks are dumped using the code-dumper.
  It's implementation is similar to the interpreter, with the exception that it
  performs no actions and just sequentially wanders through the byte code
  printing instructions along the way. The term human-readable is a bit optimistic
  though; currently, the presented data looks like an assembly language.