a bunch of unsorted thoughts about tech, software, etc.

read this site in: |

Parsing code with Sprache - Part 2

😎 This the second article of a multiple part series on how to parse code with Sprache. You can read the first part here.

In the previous post, we saw how to parse some text (in particular, Java code) using Sprache, a might library for C#. We saw how to use an incremental approach, and how to use unit tests to drive the development with this tool. So far we wrote a parser for Identifier and PackageName (check it here).

Now we are going to move forward a bit faster. Remember that we are targeting the Java/Android source project Google Authenticator and that our final goal is to output a graph of class dependencies for this project. In this article, we’re going to try and parse all top-level elements of the current file that we’re working on,

Continue reading →

Parsing code with Sprache - Part 1

😎 This the first article of a multiple part series on how to parse code with Sprache. You can read the second part here.

You probably know that sometimes (many times), a developer’s job is much more research or analysis than programming! In the past, there have been many instances where I was on a project where my goal was to migrate or rewrite old software, and during those engagements, I ended up creating tools to help me. Many of those tools were specialized code parsers that would automatically perform the analysis I required or even spit out newer code that I could reuse.

In all those cases, I needed to parse some structured code, and there’s a simple way of doing this: by using Sprache, a parsing framework for dotnet. In this article, I’m going to teach you how to do that.

Continue reading →

Happy Halloween! My blog is back!

This is my third or fourth attempt to create a blog, and I do hope that I succeed in keeping it up-to-date. At least now I finally have the time I need to create new posts, and keep it going. Also, I love GitHub pages. It’s much nicer to be in a platform that I (kinda) control.

Continue reading →