A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Microsoft/ConcordExtensibilitySamples/wiki/Iris-Compiler below:

Iris Compiler · microsoft/ConcordExtensibilitySamples Wiki · GitHub

"Iris" is a language that will look familiar to Pascal programmers. It has the following design goals:

  1. Expressive enough to write interesting programs.
  2. Language is imperative.
  3. Easy to integrate with the debugger as a sample.
  4. As simple as possible while achieving the above goals.

Iris is not intended to be a production compiler and doesn't attempt to follow any standards. It also shouldn't be considered a 'best practice' example for implementing a .NET compiler.

Learning any programming language starts with Hello World, so here is Hello World in Iris:

program HelloWorld;
begin
   writeln('Hello World');
end.

Here's a slightly more complicated program that prints the first 5 values in the Fibonacci sequence:

program Fibonacci;

function Fib(i:integer) : integer;
var
   a, b : integer;
begin
   Fib := 1;
   if i > 2 then
   begin
      a := Fib(i - 1);
      b := Fib(i - 2);
      Fib := a + b;
   end;
end

procedure Test(i:integer);
var
   result : integer;
begin
   result := Fib(i);
   writeln(str(result));
end;

begin
   Test(1);
   Test(2);
   Test(3);
   Test(4);
   Test(5);
end.

Iris can be broken down into a Front End, Back End, and an Import System.

The front end of the Iris compiler uses a recursive decent parser. For simplicity, the compiler only makes one pass over the source file. During parsing, the compiler does semantic analysis and outputs instructions and debug information via the Back End. The bulk of this code is in Translator.cs

Iris allow interchanging back ends for emitting different types of code. Each back end is an implementation of IEmitter. There is an emitter for PE files and an emitter that writes out textual CIL code.

In order to integrate with the debugger, Iris must have the ability to import metadata into its symbol table. Iris uses System.Reflection.Metadata as the metadata reader and implements an intermediate type system to convert between the rich .NET type system and the compiler's very limited type system.

The command line compiler for Iris is named "ic". It is built as part of Iris.sln in the Iris directory. To see the options for the compiler, run "ic" without any arguments. There is also a build.cmd file in the repo to build all ".iris" files in the Iris/Programs directory.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4