From Lazarus wiki
Revision as of 01:48, 4 January 2022 by Trev (talk | contribs) (→‎About: Fix typo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


SynFacilSyn is a Lazarus cross-platform library that includes a SynEdit highlighter that also can work as a lexer because of its flexible syntax definition file. It's well documented and has been used in several projects as both a highlighter and a lexer.

SynFacilSyn also includes the "adapter" for ATSynEdit.

Author: Tito Hinostroza

License: GPL 2


GitHub repository:


The main advantage of using SynFacilSyn as a lexer is that in a SynEdit editor you can actually see the tokens colored appropriately, without doing anything else. So if you define a lexer, you are defining a source highlighter too.

You can use an XML file to define the syntax, defining the tokens using tags and various RegEx constructs. You can also specify colouring of the tokens if you need it.

You can also define Syntax programmatically which means it's possible to change individual syntax elements at runtime.

SynFacilSyn's highlighter is fast and lightweight. It also includes useful methods for accessing the text content after the scan. Since it allows you to define recursive blocks and sections you can also use it as a parser.

Related tools

SynFacilSyn is the base library for other tools that can be used together to create a powerful compiler, interpreter or IDE:

  • SynFacilCompletion - Scriptable Highlighter with code-completion for the SynEdit Component of Lazarus
  • SynFacilUtils Library with utilities to create editors using SynFacilSyn and SynFacilCompletion.
  • t-Xpres Framework to create compilers/interpreters based on SynFacilSyn. Includes lexer, parser, syntaxTree, expression evaluator and support to implement code generators or virtual machines.

The following programs have been created using the above tools: