Lex and Yacc

You may encounter lex and yacc when compiling programs that read configuration files or commands.

  • Lex is a tokenizer that transforms text into numbered tags with labels. The Linux version of lex is named flex. You may need a -ll or -lfl linker flag in conjunction with lex.

  • Yacc is a parser that attempts to read tokens according to a grammar. The GNU parser is bison; to get yacc compatibility, run bison -y. You may need the -ly linker flag.

Get How Linux Works now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.