locked
Custom language that compiles to C - integrating and debugging RRS feed

  • Question

  • I'm looking at language that "compiles" to C. It's called Nim -- http://nim-lang.org/

    The higher level "nim" code files might contain, for example:

    var x: int=2
    block block1:
    echo "Hello", x, " more" & " stuff"

    My ultimate goal, if possible, is to use the VS toolchain to compile the C code (which is generated by the Nim compiler), and customize the VS debugger so that breakpoints are hit in the Nim code, and the C code is hidden or otherwise suppressed.

    The C code will include line directives:
    https://msdn.microsoft.com/en-us/library/b5w2czay.aspx

    So I can sort-of do the above manually, and I can sort-of get there with GDB.

    I realize I would have to figure out some way of displaying variables, watches, etc. I'm more interested in whether I can get even close to using the debugger in this way. I'd appreciate any samples or pointers. Thanks!

    Wednesday, February 18, 2015 6:34 PM

All replies

  • Hi Gravity,

    Let's say about C# language, Visual Studio UI only send csharp files to csc.exe and let the compile engine to the compiling stuff, Visual Studio does not directly join the compiling job, it is only a IDE.

    As I know to compile the C code in Visual Studio is possible as you can see the link you attached, and I would like understand Nim as a tool that generate your code to C code. For this purpose, you will need let Nim generate the C code and execute the cl.exe, see this for more information: Compiler Options .

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, February 19, 2015 3:29 AM
  • Hi Gravity-Well,

    According to my understanding, what you need is to integrate this custom language into Visual Studio, and provide debugging support for this language system. This is a little bit heavy task, but you can get started from scratch by checking the MSDN documentation here:

    Language Services

    Visual Studio Debugger Extensibility


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, February 26, 2015 9:59 AM