YAML syntax processing in C with libyaml and lemon parser generator (part 2)
In previous part of the blog we have created the basis of the program. In this part we will work on lemon parser grammar file "parser.y". Lemon is an application that can be installed from packages (comes almost with all Linux distributions), with Homebrew on Mac OS. Or you can build it from the sources. It is to find in Internet how to do that. When lemon is installed, we can run command "lemon" with a path to the grammar file as an argument. Using Makefile will much improve our build process: We can simply run "make" command in our working directory and it will generate the parser .c and .h files. Libyaml wiki has a grammar explained for events: http://pyyaml.org/wiki/LibYAML#Events This is basically the same for tokens. Let's start with a very minimal ( minimum minimorum ) YAML syntax (file minimum.yaml): key : value If we run now our program, we will have this in output: Here, the "key" and the ...