3 ms·
Could you go into detail why you think that a hypergraph is needed? I think every program can be represented by a directed graph of basic blocks.
by adrianN 6y ago
Could you go into detail why you think that a hypergraph is needed? I think every program can be represented by a directed graph of basic blocks.
- wrnr 6y agoI don't think you are wrong about the DAGs, though in programming language parlance they are called abstract syntax trees (AST). Sure you can do like Scratch, which is basically an AST editor instead of a code editor. Not a bad idea in of itself, but what if you start writing those basic blocks in your language of choice? Keep looking up the function definition in your IDE and at some point you end at some assembly with long jumps all over the place. The point I wanted to make was that no matter what design choice you make as a language author, to make this DAG/AST as palatable for the end user, be it with a imperative, functional, logic or concatenive style of programming, a price is aways payed, in terms of complexity at some level (time, space, ergonomics), no matter what you do.
- adrianN 6y agoI'm not thinking of the AST, but of a graph of https://en.wikipedia.org/wiki/Basic_block https://en.wikipedia.org/wiki/Basic_block
- gridlockd 6y agoYou didn't answer the question. ASTs are not DAGs, they are just trees. They also do not represent the computation, but the language syntax. Many visual programming languages are based around DAGs and they do represent the computation itself. The edges are usually not nodes either, so those DAGs are not hypergraphs.
- Ace17 6y agoFirst-order functions maybe? The following function has an obvious visual representation as a processing block: int add(int a, int b); But how do you represent a function allowing other functions in its signature, e.g: void transformInPlace(int* input, int (*func)(int));
- adrianN 6y agoThe same way the processor does. The function argument becomes a pointer you jump to when you want to call the function.
- negentropicdev 6y agoIn LabVIEW I wire in a reference to a VI that provides the functionality or I use a design similar to the command pattern where there's an override method and I specify the class instance as the argument. Depends on the granularity of the design needed and how many different classes I want to define (usually not that many).