November 5, 2018

Learning how to parse


I already forgot why my compilers class was not good, it was the teacher or it was not in my speciallity in electronic. But I heard once that if you know how to parse files you can do any challenge that presents.

I think it is not sure but I think it is a great skill that I want to have. 4 months ago I did some work generating code in Golang and I feel to generate code and compile it is a great feeling.

What and how decide to learn parsing

Well I always wanted to read the official compilers book (the one with the red dragon) but it starts with lex and flex, it is interesting but I want something newer. And because I just want the skill. I was fine with flex and bison but it turns out that I can't parse utf8 in a simple way and the actions could be only in c/c++. So I decide to start from the end. I will learn Antlr4.

Only Perl can parse Perl 6

Right now I am working with Perl and I was wondering: "should be nice if you can parse Perl to other languages" It is a hard task to parse any language to other but. After google and read  I found that Perl can only be parsed with Perl. So I was thinking in stop wondering. But there is a little hope.

It is called PPI Parse, Analyze and Manipulate Perl (without perl) that was interesting. And this is an example:

PPI - Parse, Analyze and Manipulate Perl (without perl)

There is other plan where I want to use the parser skill.

But that is other story

No comments: