19

What does the "yy" in lex.yy.c stand for?

Lesmana
  • 25,663
  • 9
  • 82
  • 87
phillipwei
  • 1,243
  • 2
  • 12
  • 25

4 Answers4

21

Lex was meant to be used in concert with Yacc. The history and details of this are detailed in Steven Johnson's paper Yacc: Yet Another Compiler Compiler. The Yacc parser uses only names beginning in "yy' - there's no apparent meaning discussed beyond simply desiring a namespace. The "yy" in lex.yy.c indicates that the lex output is intended for a yacc parser.

peterb
  • 1,360
  • 9
  • 14
1

I believe the "yy" is used to indicate that this is a generated code file.

Usually, the lex utility writes the program it generates to the file lex.yy.c - Reference

chills42
  • 14,201
  • 3
  • 42
  • 77
1

Probably from YACC (Yet Another Compiler Compiler), which was used with Lex to implement quite a few compilers and similar programs. The Gnu equivalents are Bison and Flex, and look a lot more widespread now, so the connection may not be obvious.

David Thornley
  • 56,304
  • 9
  • 91
  • 158
0

I think it comes from Yacc, one of the older parser generators.

Jonathan
  • 13,354
  • 4
  • 36
  • 32