LXR Cross Referencer

Last updated
LXR Cross Referencer
Initial releasec. 1994 (1994) [1]
Stable release
2.3.7 / July 17, 2023;4 months ago (2023-07-17)
Repository
Written in Perl
Type Indexer and cross-referencer
License GNU GPL 2
Website https://lxr.sourceforge.io/en/index.php

LXR Cross Referencer, usually known as LXR, is a general-purpose source code indexer and cross-referencer for code comprehension that provides web-based browsing of source code, with links to the definition and usage of any identifier.

Contents

History

LXR was born from a need for a tool to keep a synthetic eye on the Linux kernel during its development (whence its original name: LXR stood for "Linux Cross-Referencer"). Such a tool is all the more necessary as documentation is scarce and contributor number is high.

Two Norwegian students, Arne Georg Gleditsch and Per Kristian Gjermshus, curious about Linux architecture, began writing a small program displaying its files through a web-browser and showing variables usages after a click on the name. Aware of general interest, they posted it rapidly on SourceForge (as early as 1994? [1] ).

Time passing, fans joined the development team to give code more maturity; however their number never exceeded ten. [2] With these characteristics, LXR is a typical SourceForge-hosted project but exhibits an exceptional life duration among small projects.

One of the initial creators explored new technologies giving the LXRng spin-off. This experimental development does not contain all features present in the traditional version and departs notably from LXR founding principles.

Though no communication was really ever done around the tool, LXR made its way through some paper columns, e.g. Linux Journal. [3] However, when collecting references to LXR on the Internet, there is ambiguity between the tool itself and instances of LXR displaying indexed source code (since many sites use "LXR" in its original sense of "Linux Cross-Referencer").

After adopting LXR to index the source code for the Mozilla Application Suite, Mozilla forked LXR to into MXR (the Mozilla Cross Reference). MXR was forked in order to meet the needs of Mozilla development, namely code navigation of a mixed C++ and JavaScript codebase. After years of MXR use, Mozilla began work on a new tool with a focus on better static analysis and a dynamic Ajax UI. The result is DXR (the Dehydra Cross Reference [4] ). After DXR reached maturity, the MXR instance at mxr.mozilla.org was decommissioned. DXR was subsequently deprecated and abandoned in 2020. [5]

Technology

LXR is minimalist and adheres to the least-effort principle.

The deliberate bias towards minimalism avoids using too many different technologies. Thus, it limits the dependencies and the software can be supported by many configurations without special adaptation.

The design choices include interpreted languages (such as Java or JavaScript) barring or strict HTML 4.01 conformance.

Least-effort principle forbids tool programming if it already exists (at least as open source).

This results in web browser usage for display (HTML and CSS allow for fancy page lay-out), definitions and references stored in an available relational data base and file parsing with Exuberant ctags tool.

LXR is written in Perl, handy choice for CGI scripts, but not really fit for lexical or syntactic parsing. [6]

LXR tries to impose as few constraints as possible:

  1. several database choices: MySQL, PostgreSQL, SQLite or Oracle,
  2. choices for full text search between Glimpse and SWISH-E,
  3. free choice for HTTP server provided it can execute CGI scripts (instructions are given for Apache, Cherokee, lighttpd, Nginx and thttpd),
  4. source-file stored in real directory or in version management system repository (choice [7] between CVS, Git, [8] Mercurial and Subversion).

Usage

After software installation, which is not a trivial task but does not require expertise, source code must be pre-processed and LXR configured to display it.

The different source code versions are implemented as sub-directories.
An alternative stores source code in a version management system.

Code is indexed during a second phase: identifiers are gathered and their locations entered in a data base. Reindexing is only necessary when source code is modified or a new version added.

Afterwards, all is needed is to launch a web browser with an URL corresponding to the source code and navigate across files through the hyperlinks associated to identifiers.

Capabilities and limitations

Source code can be written in any language that Exuberant ctags can handle, but parsers are not equally fine-grained.

Two versions of the same file can be compared side by side with differences visually enhanced (through diff command launched by LXR).

Besides hyperlinks under variables, a form allows searching for an identifier typed by the user.

To work around the indexing phase limitations, any character sequence may be (full text) searched at the cost of an extensive source files traversal.

LXR limitations are those of the support tools, mainly Exuberant ctags. But the primary cause of difficulties comes essentially from incorrect access permissions to files.

Another limitation comes from the design choice to only do static code analysis, in contrast to other solutions which do semantic analysis as a compile step,

An advanced user may change LXR layout and rendering through customizing page templates (written in HTML) and cascading style sheet (CSS).

LXR collections

(archives only shows directory structure - March 2016)
(archive only shows directory structure - March 2016)
(archive not available - March 2016)

See also

Related Research Articles

<span class="mw-page-title-main">Document Object Model</span> Convention for representing and interacting with objects in HTML, XHTML, and XML documents

The Document Object Model (DOM) is a cross-platform and language-independent interface that treats an HTML or XML document as a tree structure wherein each node is an object representing a part of the document. The DOM represents a document with a logical tree. Each branch of the tree ends in a node, and each node contains objects. DOM methods allow programmatic access to the tree; with them one can change the structure, style or content of a document. Nodes can have event handlers attached to them. Once an event is triggered, the event handlers get executed.

<span class="mw-page-title-main">Bookmarklet</span> Web browser bookmark containing JavaScript code

A bookmarklet is a bookmark stored in a web browser that contains JavaScript commands that add new features to the browser. They are stored as the URL of a bookmark in a web browser or as a hyperlink on a web page. Bookmarklets are usually small snippets of JavaScript executed when user clicks on them. When clicked, bookmarklets can perform a wide variety of operations, such as running a search query from selected text or extracting data from a table.

Ctags is a programming tool that generates an index file of names found in source and header files of various programming languages to aid code comprehension. Depending on the language, functions, variables, class members, macros and so on may be indexed. These tags allow definitions to be quickly and easily located by a text editor, a code search engine, or other utility. Alternatively, there is also an output mode that generates a cross reference file, listing information about various names found in a set of language files in human-readable form.

This is a comparison of both historical and current web browsers based on developer, engine, platform(s), releases, license, and cost.

<span class="mw-page-title-main">Git</span> Software for version control of files

Git is a distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers who are collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows.

<span class="mw-page-title-main">Mozilla Application Suite</span> Discontinued Internet suite

The Mozilla Application Suite is a discontinued cross-platform integrated Internet suite. Its development was initiated by Netscape Communications Corporation, before their acquisition by AOL. It was based on the source code of Netscape Communicator. The development was spearheaded by the Mozilla Organization from 1998 to 2003, and by the Mozilla Foundation from 2003 to 2006.

Open-source software development (OSSD) is the process by which open-source software, or similar software whose source code is publicly available, is developed by an open-source software project. These are software products available with its source code under an open-source license to study, change, and improve its design. Examples of some popular open-source software products are Mozilla Firefox, Google Chromium, Android, LibreOffice and the VLC media player.

cscope Free software that allows for searching source code written in C, C++, and Java

cscope is a programming tool which works in console mode, text-based interface, that allows computer programmers or software developers to search source code of the programming language C, with some support for C++ and Java. It is often used on very large projects to aid code comprehension to find source code, functions, declarations, definitions, and regular expression. cscope is free and released under a BSD license. The original developer of cscope is Joe Steffen.

OpenGrok is a source code search and cross-reference engine. It helps programmers to search, cross-reference, and navigate source code trees to aid code comprehension.

In the context of the World Wide Web, a bookmark is a Uniform Resource Identifier (URI) that is stored for later retrieval in any of various storage formats. All modern web browsers include bookmark features. Bookmarks are called favorites or Internet shortcuts in Internet Explorer and Microsoft Edge, and by virtue of that browser's large market share, these terms have been synonymous with bookmark since the First Browser War. Bookmarks are normally accessed through a menu in the user's web browser, and folders are commonly used for organization. In addition to bookmarking methods within most browsers, many external applications offer bookmarks management.

<span class="mw-page-title-main">SlickEdit</span>

SlickEdit, previously known as Visual SlickEdit, is a cross-platform commercial source code editor, text editor, and Integrated Development Environment developed by SlickEdit, Inc. SlickEdit has integrated debuggers for GNU C/C++, Java, WinDbg, Clang C/C++ LLDB, Groovy, Google Go, Python, Perl, Ruby, Scala, PHP, Xcode, and Android JVM/NDK. SlickEdit includes such features as built in "beautifiers" that can enhance code as you type, code navigation, context tagging, symbol references, third party tool integration, DiffZilla, syntax highlighting, and 15 emulations.

JSDoc is a markup language used to annotate JavaScript source code files. Using comments containing JSDoc, programmers can add documentation describing the application programming interface of the code they're creating. This is then processed, by various tools, to produce documentation in accessible formats like HTML and Rich Text Format. The JSDoc specification is released under CC BY-SA 3.0, while its companion documentation generator and parser library is free software under the Apache License 2.0.

<span class="mw-page-title-main">Firebug (software)</span> Web development add-on for Firefox

Firebug is a discontinued free and open-source web browser extension for Mozilla Firefox that facilitated the live debugging, editing, and monitoring of any website's CSS, HTML, DOM, XHR, and JavaScript.

<span class="mw-page-title-main">CodeLite</span> Integrated development environment

CodeLite is a free and open-source IDE for the C, C++, PHP, and JavaScript (Node.js) programming languages.

<span class="mw-page-title-main">Kirix Strata</span> Specialty web browser

Kirix Strata is a specialty web browser designed for data analytics. Strata offers a browser's ability to view web pages, but also includes additional tools to perform data analysis and create reports based on structured data from local files, external relational databases and the Web.

<span class="mw-page-title-main">Lively Kernel</span> Open-source web programming environment

The Lively Kernel is an open-source web programming environment, developed by Dan Ingalls when he was at SAP Research. It supports desktop-style applications with rich graphics and direct manipulation abilities, but without the installation or upgrade troubles of conventional desktop applications. Development began at Sun Microsystems Laboratories in Menlo Park, California, and later moved to the Hasso Plattner Institute in Potsdam-Babelsberg near Berlin.

<span class="mw-page-title-main">Amber Smalltalk</span>

Amber Smalltalk, formerly named Jtalk, is an implementation of the programming language Smalltalk-80, that runs on the JavaScript runtime of a web browser. It is designed to enable client-side development using Smalltalk. The programming environment in Amber is named Helios.

<span class="mw-page-title-main">GNU GLOBAL</span>

GNU GLOBAL is a software tool for source code tagging to aid code comprehension. It works in a uniform fashion in various environments, allowing users to find all objects declared in the source files and to move among them easily. It is particularly useful for working on projects containing numerous sub-projects and complex syntax trees generated by the compilation process functions using conditional compilation). It is similar to older tagging software such as ctags and etags, but differs in its independence from any specific text editor.

Front-end web development is the development of the graphical user interface of a website, through the use of HTML, CSS, and JavaScript, so that users can view and interact with that website.

References

  1. 1 2 According to dates in SourceForge's CVS repository
  2. "LXR Cross Referencer Open Source Project on Open Hub: Contributors".
  3. Kamran Soomro (June 1, 2007). "Read source code the HTML way".
  4. "Dehydra". 2020-11-04. Archived from the original on 2021-05-18. Retrieved 2020-11-13.
  5. "Add a banner about DXR Decommission". Archived from the original on 2023-03-12. Retrieved 2023-11-07.
  6. A finite state automaton usually scans text (or source code) from left to right without backtracking. Using regular expressions in Perl incurs chances of multiple scanning of text with spurious replacement on already processed fragments.
  7. It was initially possible to use BitKeeper, but support stopped (around 2005) when license became proprietary.
  8. Git support has been fixed in release 1.0.

LXRng (fork)