Closed dmcclean closed 13 years ago
Agreed, never liked that Instr
type anyway.
I have some time, I can make the change right now.
I've made this change in the branch no-instr.
This is a breaking change, as any code that uses the label
builder function now no longer works.
This branch can be merged with master for the 0.3 release of language-cil, along with any other breaking changes. I first want to release 0.2.2 which contains just additional functionality (like unaligned
).
I've released 0.2.2 to Hackage. The no-instr branch has been merged with master.
The following CIL is legal but inexpressible in the current Syntax.hs
Multiple labels can precede the same instruction, and labels can even come at the very end after all instructions (uselessly, but its grammatically allowed and ILASM accepts and ignores it).
As a result, I think we should eliminate the Instr type entirely, change the Instr constructor in MethodDecl to wrap an OpCode (maybe it should be renamed to OpCode as well?) instead of an Instr, and add a Label constructor to MethodDecl, so that MethodDecl looks like this:
Being able to place multiple labels before the same instruction vastly simplifies composing various code generators.