Decompiler Fibo Dot Net Source

Program-Transformation.Org: The Program Transformation Wiki
This is a simple program, compiled with the Mono C# compiler, no optimisation.

Here is the original C# source code:

using System;

class Fibo {
    private static int fib (int x) {
        if (x > 1)
            return (fib(x - 1) + fib(x - 2));
        else return (x);
    }

    public static int Main( String[] args) {
    int number = 0, value;

        try {
            number = Convert.ToInt32(args[0]);  
        } catch (Exception e) {
            Console.WriteLine ("Input error");
            return 1;
        }
        value = fib(number);
        Console.WriteLine ("fibonacci({0}) = {1}", number, value);
        return 0;
    }
}

You use the program like this:

% mono Fibo 10
fibonacci(10) = 55
% mono Fibo abc
Input error
%

The corresponding Java source code (for bytecode decompiler tests) is in DecompilerFiboTestSource.

-- MikeVanEmmerik - 06 Mar 2003
CategoryDecompilation