←back to thread

261 points david927 | 1 comments | | HN request time: 0.208s | source

What are you working on? Any new ideas that you're thinking about?
Show context
liu3hao ◴[] No.43172062[source]
Working on Circuitscript, a language based on python to describe electronic schematics/circuits: https://circuitscript.net/

The main motivation for creating Circuitscript is to describe schematics in terms of code rather than graphical UIs. This makes it easier to track changes and version control with a text based schematic. I have used different CAD packages extensively (Allegro, Altium, KiCAD) in the past and wanted to spend more time thinking about the schematic design itself rather than fiddling around with GUIs.

The main language goals are to be easy to write and reason, generated graphical schematics should be displayed according to how the designer wishes so and to encourage code reuse.

replies(1): >>43187804 #
childintime ◴[] No.43187804[source]
You've gone for a Logo paradigm: turtle graphics with an inference engine behind it. It looks like its simplicity is a strength.

There are a few others in this space, often using Python as their base.

replies(1): >>43194227 #
1. liu3hao ◴[] No.43194227[source]
Yes, that is a big part of the design choice for this language. I felt that circuit elements are usually defined in relation to other circuit elements and instead of explicitly stating connections, it might provide more understanding of the overall circuit if the user builds the connections by "walking" along the circuit graph. A good side effect of this is that you skip having to name every single component in the circuit.

I was inspired by skidl (https://devbisme.github.io/skidl/)'s python usage and did explore that direction. However, it felt strange and clunky to try and fit the circuit drawing concepts I had in mind into python via a domain specific language (DSL). The user would require a decent understanding of python and the DSL to create circuits. This would complicate my original aim of creating a language/tool that allows electronics engineers to focus on the circuits that they would like to design.

By creating a new language, I was not limited by python's syntax/grammar. I could craft the language closer to what was needed for schematic design and maintain simplicity. Overall, it was a great learning experience on language design and also using ANTLR for the implementation.