Up: Introduction

1.1 Semantic Components

In this section, we provide a more detailed description of the major components of Semantic, and how they interact with one another.

The first step in parsing a source code file is to break it up into its fundamental components. This step is called lexical analysis:

             syntax table, keywords list, and options
                              |
                              |
                              v
         input file  ---->  Lexer   ----> token stream

The output of the lexical analyzer is a list of tokens that make up the file. The next step is the actual parsing, shown below:

                         parser tables
                              |
                              v
         token stream --->  Parser  ----> parse tree

The end result, the parse tree, is Semantic's internal representation of the language grammar. Semantic provides an API for Emacs Lisp programs to access the parse tree.

Parsing large files can take several seconds or more. By default, Semantic automatically caches parse trees by saving them in your .emacs.d directory. When you revisit a previously-parsed file, the parse tree is automatically reloaded from this cache, to save time. See SemanticDB.