9.5. Code Review for the test Command

We implemented the Laddie CLI using lex, yacc, and RTA. The vocabulary of Laddie's verb-adjective-noun CLI is recognized by a parser generated by lex, and the grammar of the CLI is recognized in a C file generated by yacc. A tutorial on lex or yacc or a full code review of the CLI is beyond the scope of this book, but we can give an overview of our code and look at all of the incremental code used to implement one command. This review might make a nice introduction to yacc and lex if you've never used them, as it will give you a sense of their power and elegance.

The code is broken into four files: main.c, syntax.y, token.l, and commands.c. The file main.c has the main() routine, which is select()-based, since ...

Get Linux Appliance Design now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.