semantic: Introduction

 
 1 Introduction
 **************
 
 This chapter gives an overview of Semantic and its goals.
 
    Ordinarily, Emacs uses regular expressions (and syntax tables) to
 analyze source code for purposes such as syntax highlighting.  This
 approach, though simple and efficient, has its limitations: roughly
 speaking, it only “guesses” the meaning of each piece of source code in
 the context of the programming language, instead of rigorously
 “understanding” it.
 
    Semantic provides a new infrastructure to analyze source code using
 “parsers” instead of regular expressions.  It contains two built-in
 parser generators (an LL generator named ‘Bovine’ and an LALR generator
 named ‘Wisent’, both written in Emacs Lisp), and parsers for several
 common programming languages.  It can also make use of “external
 parsers”—programs such as GNU Global and GNU IDUtils.
 
    Semantic provides a uniform, language-independent API for accessing
 the parser output.  This output can be used by other Emacs Lisp programs
 to implement “syntax-aware” behavior.  Semantic itself includes several
 such utilities, including user-level Emacs commands for navigating,
 searching, and completing source code.
 
    The following diagram illustrates the structure of the Semantic
 package:
 
 *Please Note:*
      The words in all-capital are those that Semantic itself provides.
      Others are current or future languages or applications that are not
      distributed along with Semantic.
 
                                                                   Applications
                                                                       and
                                                                    Utilities
                                                                      -------
                                                                     /       \
                     +---------------+    +--------+    +--------+
               C --->| C      PARSER |--->|        |    |        |
                     +---------------+    |        |    |        |
                     +---------------+    | COMMON |    | COMMON |<--- SPEEDBAR
            Java --->| JAVA   PARSER |--->| PARSE  |    |        |
                     +---------------+    | TREE   |    | PARSE  |<--- SEMANTICDB
                     +---------------+    | FORMAT |    | API    |
          Scheme --->| SCHEME PARSER |--->|        |    |        |<--- ecb
                     +---------------+    |        |    |        |
                     +---------------+    |        |    |        |
         Texinfo --->| TEXI.  PARSER |--->|        |    |        |
                     +---------------+    |        |    |        |
 
                          ...                ...           ...         ...
 
                     +---------------+    |        |    |        |
         Lang. Y --->| Y      Parser |--->|        |    |        |<--- app. ?
                     +---------------+    |        |    |        |
                     +---------------+    |        |    |        |<--- app. ?
         Lang. Z --->| Z      Parser |--->|        |    |        |
                     +---------------+    +--------+    +--------+
 

Menu