From the page:
Semantic is actually composed of two well distinguished parts: a parsing engine (tags collector) and a tags accessor. Good part of what follows is taken by a thread posted in both ECB-list and CEDET-devel by the main developers of ECB (Klaus Berndl) and CEDET (Eric M. Ludlam).
Semantic includes two parsing engines:
Both parsers are implemented in Elisp. The final goal of a parser may be considered collect tags from the analysed code.
A tag is just a name for one lexical and/or semantic token in a language (e.g. a variable, a method definition, an include-operator etc.). A tag contains several informations, at least the name of the tag (i.e. the name of the variable, class, method….) and the location of this tag in the buffer (i.e.. begin- and end-position) and probably also the file-name the tag belongs to.
In order to collect this information the parsing engine needs to actually understand the syntax (lexer) and the grammar (parser) of the language in question. So we need to feed the parser with the grammar for that language.
The analysis or parsing may be performed on a limited part of the buffer (for example in the current function or block) or on the whole file. Once the analysis is performed the SemanticBovinator provide functions to import those tags into a global DB or into a local cache.
Currently the semantic parsing engine consists of a general backbone and several parsers for each supported languages (as Emacs-Lisp itself, Java, C, C++ etc.). Semantic offers several interfaces (Elisp-functions) to get parsing information about the currently file or buffer. The output can be a single tag (e.g. semantic has a function which returns the tag at point) or also a list of tags (e.g. all tags in the current buffer).
There are, both in the Emacs environment and amongst UNIX tools, various other methods to extract tags information (which may be integrated in the semantic framework, see below), although not always with the same accuracy of a parser engine:
‘etags’: an external command line tool which scans program files in several languages and writes a tags file. These tags have a different structure from the tags returned by SemanticBovinator. Emacs offers an Elisp-interface to the
‘etags’program – see EmacsTags.
‘etags’precursor, but with limited functionality respect to
‘etags’(fewer supported languages).
‘ebrowse’: is a somehow clumsy mixture consisting of a fast(!) C++-parser and display/navigation features and is part of Gnu Emacs >= 21. It’s not written in Elisp but in C - at least the parser-core and has an Elisp-interface giving access to the tags (which resides in an external file similar to the
‘cscope’: another stand-alone command-line tags collector C++/C oriented.
So semantic is a parsing engine, whose final goal is to build a database containing tags (information for each piece of information contained in a code file, e.g. functions, variables, declaration and their attributes).
But semantic also provides a system to extract from different tags sources collected by other programs (eventually faster than Bovinator/Wysent itself) and import them in the semantic DB.
CEDET now can enable access to an Ebrowse-tag-file (in general to any arbitrary back-end containing tags in any arbitrary tag-format) and offers an interface to convert these Ebrowse-tags in semantic-tag-format. So semantic (and each tags displayer like SpeedBar or ECB) can take advantage from the Ebrowse-program which is really fast in parsing a huge code-base of C++-code.
Here is a summary of some of the user level tools in Semantic
The Semantic Bovinator can also be used as a powerful tool to ease C++ programming: see SemanticSense.
For natural languages, see MalagaMode?.
LocalWords: Elisp Bovinator Wysent CEDET Ebrowse SpeedBar