.L

Файл L

Lex Language Source File
Задать вопрос
БЫСТРЫЙ ОТВЕТ

An L file is a Lex or Flex source file - a plain-text specification for a lexical analyzer (tokenizer), used in compiler and interpreter development. Open it in any code editor; to build the scanner, run flex on it. The extension is also used for Lisp source and Unix man pages, so check the file content if unclear.

Разработчик: Mike Lesk and Eric Schmidt (Lex, Bell Labs); Vern Paxson (Flex) Категория: Файлы разработчика Открыть стандартное MIME: text/plain
ОТКРЫВАЕТСЯ НА Windows macOS Linux
Связанные: .DO · .MD · .HEX · .XSD

На этой странице

Проиндексировано расширений: 19k+
Последняя проверка: Sep 6, 2026

Не знаете, что это за файл?

Перетащите любой файл в наш идентификатор - мы прочитаем первые байты, чтобы определить формат.

Идентифицировать файл

Что такое формат файла L?

A .l file is a plain-text lexical-analyzer specification written in the Lex language. It defines how an input character stream should be broken into tokens - the first step in building a compiler, interpreter, or text-processing tool.

The format was created at Bell Labs in 1975 by Mike Lesk and Eric Schmidt as part of the Unix toolchain. Today virtually all .l files are processed by Flex (Fast Lexical Analyzer), the GNU-era open-source successor developed by Vern Paxson, though the source syntax remains largely the same.

A .l file is divided into three sections separated by %% marker lines:

  • Definitions - named regex macros and %option directives
  • Rules - pairs of regular expressions and C action code that fire on a match
  • User code - optional helper C functions appended verbatim to the output

An optional %{ ... %} block near the top injects C declarations directly into the generated scanner. Running flex yourfile.l (or lex yourfile.l) produces lex.yy.c, a self-contained C source file implementing the scanner as a deterministic finite automaton. That output is compiled with a C compiler and typically linked with a Yacc/Bison grammar file to build a complete language processor.

Note that .l is also used for Lisp source files and Unix troff manual-page sources, so file context matters when identifying the type.

Безопасность и защита

РИСК: LOW

A .l Lex source is plain text and safe to open in an editor. The only caution: the rules contain C action code, and a malicious .l could embed harmful C that runs once compiled. Review .l files from untrusted sources before running flex and building them.

Детали формата

в двух словах
ПОЛНОЕ НАЗВАНИЕLex Language Source Fileтакже известен как Lex source, Flex source file
РАЗРАБОТЧИКMike Lesk and Eric Schmidt (Lex, Bell Labs); Vern Paxson (Flex)с Lex, 1975 (Unix); standardized in POSIX (lex utility)
MIME-ТИПtext/plain
ТИПPlain-text lexical-analyzer specification (source code)
СТАНДАРТОткрытый · без роялти
СВЯЗАННЫЕ.do.md.hex.xsd
Это расширение также используется в…
  • Lisp source file (.l) - Some Lisp dialects/implementations use .l for source code; plain text, but a different language than Lex.
  • Unix man-page / troff source (.l) - Section-l (local) manual pages in nroff/troff source; documentation, not a lexer spec.
  • Interleaf / WordPerfect library (.l) - Legacy library or list files in older document systems; rare.

Программы, открывающие файлы L

Windows3 apps
Notepad Открытый код Open directly to view/edit the lexer specification.
Visual Studio Code Бесплатно Open the .l to read/edit; install a Lex/Flex syntax extension for highlighting.
Flex (win_flex via WinFlexBison) Открытый код Run 'win_flex file.l' to generate the C scanner source on Windows.
macOS1 app
TextEdit / VS Code Бесплатно Open to read/edit; run 'flex file.l' in Terminal to build the scanner.
Linux2 apps
Flex Открытый код Run 'flex file.l' to generate lex.yy.c, then compile with cc.
GNU Emacs / Vim / gedit Открытый код Open the .l in any editor to read or modify the lexer rules.

Технические подробности

глубокая спецификация
Format typePlain-text lexical-analyzer specification (source code)
EncodingASCII / UTF-8 plain text; no binary header or magic bytes
File structureThree sections separated by `%%`: definitions, rules, and user C code
Section 1 - DefinitionsNamed regex macros and `%option` directives (e.g., `%option noyywrap`)
Section 2 - RulesPairs of regular-expression patterns and C action code blocks executed on match
Section 3 - User codeOptional C helper functions copied verbatim into the generated output file
C-code injection block`%{ ... %}` prologue near the top injects C declarations into the generated scanner
Primary output`lex.yy.c` - a C source file implementing a DFA-based scanner
MIME type`text/plain` (informal alias: `text/x-lex`)
Processing tools`lex` (AT&T/POSIX), `flex` (GNU), `win_flex` (Windows via WinFlexBison)
Typical file size1 KB - 100 KB
Scanner algorithmCompiles regex rules to a deterministic finite automaton (DFA) at build time
Common pairingCombined with a `.y` Yacc or Bison grammar file to build a complete compiler front-end
Platform supportUnix, Linux, macOS natively; Windows via MSYS2, Cygwin, or WinFlexBison
Extension ambiguity`.l` is also used for Lisp source files and Unix troff man-page source - file context required
ВыпущенLex, 1975 (Unix); standardized in POSIX (lex utility)
Последняя версияFlex 2.6.4 (2017) is the de-facto current implementation reading .l files
Открыть стандартноеДа · без роялти
Спецификацияpubs.opengroup.org

Конвертации L

Вопросы и ответы сообщества

спрошено пользователями
Задать быстрый вопрос
Получите помощь от людей, работающих с файлами L. Будьте конкретны - укажите вашу систему и версию ПО.
Аккаунт не нужен · ответы обычно в течение дня

Вопросов пока нет - станьте первым, кто спросит о файлах L.

Часто задаваемые вопросы

What is a .L file?
It is a Lex/Flex source file - a plain-text specification of a lexical analyzer (tokenizer). Flex compiles it into C source for a scanner. '.l' is also used for Lisp and man pages.
How do I open a .l file?
Open it in any code editor (VS Code, Notepad++, Vim, Emacs). It is plain text.
How do I run or compile a .l file?
Run 'flex yourfile.l' to generate lex.yy.c, then compile that C file (e.g. 'cc lex.yy.c -lfl'). On Windows use win_flex from WinFlexBison.
What's the difference between a .l and a .y file?
.l is a Lex/Flex lexer spec (tokenizing); .y is a Yacc/Bison grammar (parsing). They are usually used together to build a compiler.
Is .l the same as a Lisp file?
Not necessarily. Some Lisp dialects use .l for source code, but in compiler tooling .l almost always means a Lex/Flex lexer specification. Check the file content.
Is Lex still used, or is it Flex now?
Flex is the modern, maintained implementation and reads the same .l files; the original AT&T Lex is largely historical, but the .l source format remains standard.

Ссылки

1POSIX lex utility specificationpubs.opengroup.org
2Flex - The Fast Lexical Analyzergithub.com

Узнать больше

по всей базе данных

Популярные расширения на этой неделе

1.AQQAQQ Instant Messenger File
2.BINCD/DVD Disc Image (BIN/CUE)
3.PARTPartial Download File
4.MDMarkdown Document
5.RPMSGRestricted Permission Message
6.CRDOWNLOADChrome Partial Download File
7.NOMEDIAAndroid No-Media Marker File
8.PRDXSoftMaker Presentations Document
9.PRO6XProPresenter 6 Bundle File
10.SWFSmall Web Format (Shockwave Flash)

Похожие расширения

.DOStata Do-File
.MDMarkdown Document
.HEXIntel HEX File
.XSDXML Schema Definition
.MAPSource Map (JavaScript / CSS)
.CONFIGConfiguration File

Бесплатные инструменты для файлов

Идентификатор файлов и конвертер изображений в браузере - все работает на вашем устройстве.

Открыть инструменты

Обзор расширений файлов A-Z