-
Notifications
You must be signed in to change notification settings - Fork 52
Managed Expression Evaluator Sample
To demonstrate integration of a .NET language with the debugger, this repo contains a sample compiler named Iris as well as a .NET Expression Evaluator (EE).
The sample compiler and EE are in the "Iris" directory at the root of the repo. This folder contains several subdirectories:
Directory | Description |
---|---|
FrontEndTest | Contains unit tests focused on the front end parts of the Iris compiler. These tests can be run from within Visual Studio using "Test Explorer" or outside of Visual Studio by using MSTest. |
ic | This project is a command line driver for the Iris compiler. |
IrisCompiler | This project builds a .dll containing the code for the compiler itself. This .dll is referenced by the command line driver as well as the EE component |
IrisExtension | This is a vsix (Visual Studio Extension) project containing all of the EE components as well as some registration information for the Iris language and EE. We'll go into more detail of IrisExtension below... |
IrisRuntime | This is the runtime .dll referenced by Iris programs. It currently only contains two methods. One method is used by the compiler to initialize string arrays. The other is the implementation of rand . |
Programs | This folder contains sample programs written in the Iris language as well as a .cmd file for building them |
-
First clone the repository (or a fork of the repo) to your local machine.
-
Open Visual Studio and add the package source to get System.Reflection.Metadata
-
Go to Tools -> NuGet Package Manager -> Package Manager Settings.
-
On the left side, select "Package Sources"
-
Add a new Package Source with these settings:
Name: "myget.org CoreFx"
Source: "https://www.myget.org/F/dotnet-corefx"
-
Save your settings. You should now be able to build Iris.sln.
-
Open and build Iris.sln in Visual Studio
First you'll want an Iris program to debug. The Iris/Programs directory contains a sample program named TicTacToe.iris. We'll use that program to try out the debugger.
To build TicTacToe.iris:
- Open a command prompt
- cd to /Iris/Programs
- Run "build.cmd"
Following these steps should have created TicTacToe.exe and TicTacToe.pdb. We can now try debugging TicTacToe.exe. To do that follow these steps:
- Open Iris.sln in Visual Studio (if you don't already have it loaded)
- Set IrisExtension as the Startup Project
- Right click on IrisExtension and select "Properties"
- Select the "Debug" tab
- Select "Start External Program".
- For "External Program" enter "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe" (or whatever the correct path is for your Visual Studio install"
- For "Command Line Arguments" enter "/rootsuffix Exp"
- You can now run the Visual Studio with the Extension using Ctrl-F5 (or F5 if you want to debug the debugger).
- From the new Visual Studio you just started, select "Open Project or Solution".
- Navigate to and open the TicTacToe.exe you built above.
- In the project properties, make sure the debugger is "Managed (v4.5 v4.0)"
- Push F10 (step)
- This should automatically open TicTacToe.iris and you'll be stopped at the "begin" of the main block.
- Notice that you can set breakpoints, step, and the variable inspection windows are working (Autos window and DataTips require a language service so they will not do anything).
- Also notice that advanced features of the debugger such as Set Next Statement, Step into Specific, and Conditional Breakpoints are all available and are flavored in the Iris language.
- It's also possible to modify values in the Watch and Locals windows when it's allowed by the compiler.
Concord Documentation:
- Overview
- Visual Studio 2022 support
- Concord Architecture
- Getting troubleshooting logs
- Tips for debugging extensions
- Component Discovery and Configuration
- Component Levels
- Navigating the Concord API
- Obtaining the Concord API headers, libraries, etc
- Concord Threading Model
- Data Container API
- Creating and Closing Objects
- Expression Evaluators (EEs)
- .NET language EEs
- Native language EEs
- Installing Extensions
- Cross Platform and VS Code scenarios:
- Implementing components in native code:
- Worker Process Remoting
Samples: