Skip to main content

18 posts tagged with "c#"

View All Tags

LLVM Kaleidoscope .NET

· 5 min read

LLVM Kaleidoscope .NET

If you're reading and learning about compilers in these days you will at some point find something about LLVM. I did and I tried to implement the Kaleidoscope tutorial from the official documentation using C#. I won't write a full blown tutorial and in the end I didn't actually follow the official tutorial as it was pretty hard for me to read C++ code.

Workflows with the visitor pattern

· 11 min read

Workflows

As a software developer I work, most of the times, on LOB applications that support some kind of process or workflow for a specific company. That means that there are some entities, such as customers, orders or support tickets, and that they evolve during the lifecycle of the application. For example we could have a CRM with a lead entity that evolves into a customer or we could track the state of a ticket: open -> analysis -> work -> deploy.

Parsing polynomials with the Pratt algorithm

· 4 min read

polynomials-pratt-algorithm

Using a Pratt parser I aim to parse expressions like this x^2+y^2-1, x=1, y=1 and xy, x=2, y=3. Parsing mathematical expressions it's not hard but it already contains some interesting behaviour such as associativity between operators x+y*z is equal to x+(y*z) and not (x+y)*z. For no particular reason I decided to put the variable assignments after the polynomial. The expression x^2+y^2-1, x=1, y=1 is to be interpreted as you would with this pseudo code

Antlr4 polynomial grammar - 2020 update

· 5 min read

Antlr4

A few years back I was playing with Antlr to build a polynomial evaluator. The result was working but not very sofisticated o particularly good, just a minimal working example. In these days of quarantine in Italy, I decided to get back a that project and try to make something better. The final result can be found at this repo.

Railway oriented programming with C#

· 5 min read

2021-09-29 I added an example on how to use ROP in an ASP.NET Core project here

A few days back I was reading about Railway oriented programming (ROP) on the awesome fsharpforfunandprofit website. Scott Wlaschin (SW) describe a functional approach to error handling not regarding only exceptions but in general how to handle deviations from the happy path. I really liked his approach and I tried to translate the F# code to C# and in this post I'll briefly recap what I've learned.

Antlr4 polynomial grammar

· 5 min read

Antlr4

Update April 2020, hey! I updated this article and the corresponding repo check it out here

In the last couple of months I've been reading and studying about compilers and languages and for everyone doing something like that it's very easy to meet Antlr at a certain point. What is antlr?