[m-rev.] for review: csharp.ssdebug and readme

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Oct 25 21:03:42 AEDT 2010


Hi Peter,

On Mon, 25 Oct 2010, Peter Wang wrote:

> Branches: main
>
> Make it possible to install and use the csharp.ssdebug grade.
>
> Mmake.workspace:
>        Never try to link with `mer_rt' in C# grades.
>
> browser/Mmakefile:
> mdbcomp/Mmakefile:
> ssdb/Mmakefile:
>        Use `mmc --make' to install these libraries in `csharp' grades.
>
>        Don't add C libraries to MLLIBS in non-C or asm grades.
>
> browser/Mercury.options:
> ssdb/Mercury.options:
>        "EXTRA_LIBRARIES-libname" doesn't actually work with `mmc --make',
>        but "LIBRARIES-name" does.

Bug or feature?

Either way, please check that this change doesn't break things.
(Acutally, why does it not affect the Java and Erlang grades?)

> library/exception.m:
> ssdb/ssdb.m:
>        Handle EXCP events in C# grades.
>
>        Trap SIGINT when running ssdb in C# grades.
>
>        Add `exit_process' implementation.
>
> browser/declarative_execution.m:
> browser/listing.m:
>        Add stubs for C#.
>
> README.CSharp:
>        Document the C# backend.
>
> README.DotNet:
>        Add a pointer to README.CSharp.
>
> configure.in:
>        Make `configure --enable-ssdebug-grades' add `csharp.ssdebug'
>        to the list of library grades.

You also need to update the description of that option in .INSTALL.in.
(Is there a --enable-csharp-grade option along the lines of the
--enable-java-grade, --enable-erlang-grade options?)

> --- /dev/null
> +++ b/README.CSharp
> @@ -0,0 +1,131 @@
> +-----------------------------------------------------------------------------
> +
> +INTRODUCTION
> +
> +This release of Mercury contains a port to the ECMA Common Language
> +Infrastructure (CLI), i.e. Microsoft .NET or Mono.  The Mercury
> +compiler will generate C# source code that can be compiled into
> +bytecode suitable for running in the .NET or Mono runtime systems.

s/in the/on the/

> +
> +The port is mostly complete, but some parts of the Mercury standard
> +library are not yet implemented (for a full list see the FAQ below).
> +
> +The port is currently targeted at C# 2.0 or higher.
> +
> +NOTE: a previous backend also targetted the .NET runtime, by generating IL
> +(Intermediate Language), rather going via C#.  That backend is out-of-date

... rather than going via C#.

> +and may be removed in the future.
>
> +PREREQUISITES
> +
> +In order to try this system you will need
> +
> +        - Either Microsoft.NET or Mono 2.8 or above.
> +
> +	- The Mercury distribution -- installed as usual.
>  You can install
> +	  from either the source or binary distribution.

I know this is cut-and-paste from README.{Java,Erlang}, but what does
that mean?  Do I need Mercury already installed before I can install
the csharp grade -- I shouldn't since I should just be able to use
the srcdist and specify csharp as one of the grades.

> +	  If you're reading this file from somewhere other than the
> +	  Mercury distribution, try the Mercury homepage at
> +		<http://www.mercury.csse.unimelb.edu.au>
> +
> +WARNING
> +
> +Please note that the C# backend is still an experimental feature.
> +
> +-----------------------------------------------------------------------------
> +
> +THE C# GRADE
> +
> +The Mercury compiler currently supports the grade `csharp'.
> +The csharp grade is enabled by using any of the options
> +`--grade csharp', `--target csharp', or just `--csharp'.
> +
> +To run a Mercury program using the csharp grade, you need to build the Mercury
> +library and runtime in the csharp grade, using the Mercury source distribution.
> +
> +You can now build programs such as hello.m or calculator.m in the samples
> +directory.
> +
> +	cd samples
> +	mmc --make --csharp hello
> +
> +Now you can run hello
> +
> +	./hello
> +
> +-----------------------------------------------------------------------------
> +
> +USING C#
> +
> +The Mercury standard library has not been fully ported to C# yet.
> +The use of unimplemented procedures will result in a run-time error,
> +with a message such as "Sorry, not implemented: foreign code for this
> +function", and a stack trace.
> +
> +If you find missing functionality, you can interface to C# using Mercury's
> +foreign language interface.
> +
> +For example:
> +
> +:- pred to_string(T::in, string::out) is det.
> +:- pragma foreign_proc("C#", to_string(T::in, Str::out), [],
> +"
> +        Str = T.ToString();
> +").
> +
> +The implementation will include this C# code in the module's .cs file, and
> +you can then call the predicate to_string exactly the same as if it were
> +implemented using pure Mercury code.
> +
> +For more information about the foreign language interface, see the Mercury
> +Language Reference Manual, which you can find at:
> +
> +     <http://www.mercury.csse.unimelb.edu.au/information/documentation.html>
> +
> +-----------------------------------------------------------------------------
> +
> +FREQUENTLY ASKED QUESTIONS (FAQS)
> +
> +Q. What are the advantages of using the C# back-end?
> +
> +A. The main advantage is easy access to the wide range of libraries for the
> +   .NET platform, and the portability you get from using CIL bytecode.
> +
> +
> +Q. What features are not yet implemented for the C# back-end?
> +
> +A. The following implementation features are not supported:
> +
> +	Mercury-level debugging (but see next question)
> +	Mercury-level profiling
> +	trailing
> +	tabling
> +
> +   In addition, the following individual procedures are incompletely
> +   implemented:
> +
> +	io.read_binary/{3,4}:
> +	io.write_binary/{3,4}:
> +		io.read_binary is broken.
> +
> +	benchmarking.report_stats/0:
> +	benchmarking.report_full_memory_stats/0:
> +		Memory usage statistics are not yet available, and cpu time
> +		is not the same as in the C backends, as per time.m.
> +
> +	store.arg_ref/5:
> +	store.new_arg_ref/5:
> +		Due to the absence of RTTI, dynamic type checking is missing
> +		for these predicates.  They should be used with care.
> +
> +   This list is not complete.
> +
> +
> +Q. How do I debug Mercury programs on .NET?
> +
> +A. The only Mercury-level debugger available for C# grades is the
> +   source-to-source debugger; see README.ssdebug.
> +
> +
> +-----------------------------------------------------------------------------
> diff --git a/README.DotNet b/README.DotNet
> index be6c1ee..42ecbb5 100644
> --- a/README.DotNet
> +++ b/README.DotNet
> @@ -1,5 +1,10 @@
> -----------------------------------------------------------------------------
>
> +WARNING
> +
> +The .NET backend described herein is out-of-date and may be removed in
> +the future.  See README.CSharp about a newer backend that targets C#.

Change that last sentence to:

    See README.Charp for details of a newer backend that targets .NET.

> INTRODUCTION
>
> This release of Mercury contains a port to the Microsoft.NET Common
> diff --git a/README.ssdebug b/README.ssdebug
> index 3e5475e..4e6a8c5 100644

The rest looks fine.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list