Falling in love with D, but...

Dan murpsoft at hotmail.com
Mon Apr 16 10:17:10 PDT 2007


In line with that thinking...

I had once thought of creating a programming engine - for lack of something better to call it - which would represent algorithms correctly.  This idea was from a long time ago before I really knew how to program.  

The idea was to implement an Operation struct, which would carry the hexcode of the operation, including operands, and from that would abstract the operands and operator information.  The idea was to provide arrays of these operations, and then slice them and access the slice as an operand for branching and looping Operations.

The problems I encountered were:
- that x86 assembly operations are never the same size
- that slices are bigger than an x86 operand (void* + length)
- that branches and loops are performed accross two operations (the compare(s) and the jump(s))
- that nobody understood what the heck I was talking about.

It seems to me that algorithms are arrays of operations that are traversed and executed in a polylinear sequential fashion.  Representing them as such seems more natural to me than inventing words for different branch and loop operations, which are algorithmically very similar.

An "if" has a buffer that gets executed for the true condition, which, when complete, EIP goes to the start of the *next* statement.

A "while" has exactly the same thing, except that when that buffer is completed, EIP goes back to the start of the *same* statement.

Such differences are an off-by-one; hardly worthy of being granted their own keywords.



More information about the Digitalmars-d mailing list