Steve Dekorte
01/20/2023, 7:08 PMguitarvydas
01/22/2023, 2:06 PM... function-name (...) {...}
In Ohm-JS, you can say this, whereas in a CFG-based parser generator you need to over-specify all of the niggly bits of C syntax. In Ohm-JS, this results in a few minutes of work and only a few lines of code. The Ohm-Editor assists in developing the micro-grammar.
In YACC and CFG-based approaches, though, you’re looking at a gargantuan job (days, weeks, months, ...) and you simply don’t bother to write such a quickie parser. You either don’t bother with the whole idea, or you use something like REGEX which fails on a number of edge-cases for this kind of thing. REGEX can’t search recursively for matching brackets, Ohm-JS can. Using REGEX, you might get away with a partial solution, or, the project might grow larger as you hit unexpected speed bumps. You either persevere or you just give up.
For the record, the grammar plus the accompanying code fabricator specification for the above simple example are shown in the appendix.
### DaS Comes For Free
When you can build totally isolated building blocks, you can draw sensible diagrams of how the building blocks should be snapped together to solve a problem.
Later, you can steal (cut/copy/paste) chunks of previous solutions and use them as building blocks for new problems.
DaS: Diagrams as Syntax.
DaS is not diagrams as an Art Form. DaS is diagrams as programming languages. For example, instead of writing {...}
, you draw a rectangle.
Programming languages were created by culling the English language and by choosing only the words and phrases that could be compiled to executable code.
Can we cull diagrams in the same way to invent new programming languages?
EE’s have done this and they call the resulting diagrams “schematics”.
Building construction engineers have done this and call the resulting diagrams “blueprints”.
## Don’t We Already Use Building Blocks?
“Code Libraries” look like building blocks, but, contain subtle bits of coupling that discourage building-block-iness.
For example, the very common idiom of a function call f(x)
introduces at least 3 kinds of coupling:
1. The name f
is hard-wired into the caller’s code. The calling code cannot be cut/copy/pasted into some other solution without also dragging in the called code, or, by futzing with the source code.
2. The function call f(x)
waits for the callee to return a value. This is also known as blocking. Function call notation works fine on paper, where functions can be evaluated instantaneously. It’s different when you map function call syntax onto hardware that has propagation delays wherein functions take finite amounts of time to “run”. This subtle difference in behaviour leads to hidden gotchas. A glaring example of the impact of such a difference can be seen in the Mars Pathfinder disaster[^pathfinder].
3. The function return v = f(x)
hard-wires a routing decision into the callee’s code. The callee must direct its response back to the caller. This is called “returning a value”. Again, this doesn’t look like a problem when you just want to build fancier calculators, but, this hard-wired routing decision discourages simple solutions to non-calculator problems, like machine control.
[^pathfinder]: https://www.rapitasystems.com/blog/what-really-happened-software-mars-pathfinder-spacecraft
When you don’t have complete isolation, you don’t have building blocks. Imagine a LEGO® set where all the pieces are joined together with a single, long sewing thread glued to each LEGO® block. Or, you have two real-world objects, e.g. one apple and one orange. You cut the apple in half. What happens to the orange?
As humans, we are used to the idea that objects are completely isolated. Programs don’t work that way. We have to stop and think hard when writing programs.Nick Arner
01/25/2023, 12:44 AMJonas
01/28/2023, 6:51 PMIvan Reese
Steve Dekorte
02/01/2023, 8:38 PMMariano Guerra
Jim Meyer
02/09/2023, 11:34 AMKalvin
02/16/2023, 1:04 AMIbro
02/20/2023, 12:41 PMOleksandr Kryvonos
02/21/2023, 10:20 AMEli Mellen
02/22/2023, 2:25 PMJarno Montonen
02/22/2023, 2:43 PMJarno Montonen
02/23/2023, 12:32 PMJason Morris
02/28/2023, 6:11 AMNiall McCormack
03/01/2023, 9:03 PMguitarvydas
03/03/2023, 7:50 PMhttps://www.youtube.com/watch?v=5YjsSDDWFDY&list=PLcGKfGEEONaDO2dvGEdodnqG5cSnZ96W1&index=28▾
Jared Forsyth
03/06/2023, 6:54 PMIvan Lugo
03/16/2023, 2:05 PMMariano Guerra
Mariano Guerra
wtaysom
03/24/2023, 7:17 AMNick Smith
03/27/2023, 4:51 AMJarno Montonen
03/27/2023, 7:30 AMIbro
03/27/2023, 2:32 PMJoakim Ahnfelt-Rønne
03/28/2023, 9:04 AMIvan Reese
Adriaan Leijnse
04/04/2023, 3:39 PMJosh Justice
04/10/2023, 12:44 PMguitarvydas
04/11/2023, 8:58 AM