I don’t have a computer science background, so I’m not sure if there is a better way of doing this, but I had a great time parsing ladder logic using Nx.
Ladder logic is a graphical programming language for PLCs (programmable logic controllers) that was designed to mimic electrical schematics. Ladder logic is popular in industrial settings and has been for decades. I thought it would be useful to be able to transform ladder logic into Elixir.
The solution I settled on was to convert the text that represents a rung to a matrix, then scan the matrix looking for certain symbols.
Not sure if there are many control systems engineers in the elixir community, but hopefully someone finds this approach useful.