3

I'm working on an MSIL (CIL) code colorizer, even though I'm not that familiar with with MSIL.

I found a list of all the keywords in the Common Language Infrastructure (CLI).

These keywords include stuff like add, .file, conv.i4, and unaligned..

I'm struggling a little bit with the dots being part of the keyword. I'm pretty sure the dots to need to be part of the key words, as I don't think things like i4 stand as keywords on their own. And I'm pretty sure I want the dot at the start of some keywords to be part of the keyword.

But what about the few that have the trailing dot, such as the last one? Is there any reason that trailing dot is part of the keyword?

Jonathan Wood
  • 65,341
  • 71
  • 269
  • 466

1 Answers1

4

The dot is part of those instructions (I don't know the reason why). There are several other prefix instructions like that, for example unaligned., volatile., constrained., readonly. and tail.. (I'm not sure I listed all of them but the point is, your parser will have to recognize these.)

The documentation of volatile. specifically mentions that at least a single whitespace must follow it before the instruction to which it applies. For example:

volatile. ldind.i4 // Correct

and

volatile.ldind.i4 // Syntax error

These are from Serge Lidin's Expert .NET 2.0 IL Assembler (which is pretty much the definitive IL reference).

xxbbcc
  • 16,930
  • 5
  • 50
  • 83
  • Yes, I have a complete list from the source I referenced. Having my parser recognize them is no problem if, as you state, a space must come after. Just wanting to ensure correct results. Thanks. – Jonathan Wood Oct 18 '14 at 20:52
  • Yes, Lidin's book mentions _The ILAsm syntax requires the prefix instructions to be separated from the next instruction by at least a space symbol._ This applies to all prefix instructions. – xxbbcc Oct 18 '14 at 20:58