[m-dev.] Mercury front ends

Michael Day mcda at cat.cs.mu.OZ.AU
Tue Jan 25 01:14:50 AEDT 2000


> I think you missed my point. I wasn't saying that we should make it soley
> accept LaTeX documents. I was saying that we should add the ability to use
> literate source files - then you can use *whatever you want* since in a
> literace source file you have to mark the -code-, not the comments.

That does not permit XML or any other form of markup of the code, it
merely allows arbitrary comments, which are possible now anyway. For a C++
example, replace this:

{
	// pointless code

	int i = 3;

	if (i == 3)
	{
		cout << "Yes";
	}
}

with this:

<block>
	<comment>pointless code</comment>
	<var name="i">
		<type><integer/></type>
		<value><integer value="3"/></value>
	</var>
	<if>
		<condition>
			<op name="==">
				<ref name="i"/>
				<integer value="3"/>
			</op>
		</condition>
		<then>
			<block>
				<op name="<<">
					<ref name="cout"/>
					<string value="Yes"/>
				</op>
			</block>
		</then>
	</if>
</block>

It may look like a horrendous mess, but note that the indentation and
whitespace is purely to make it easier for me to type it in, and is not
required at all. In fact, there is no formatting information contained in
the code at all, nor is any necessary (unless you have a specific style
hint that you wish applied).

So if I view the code with my preferences set to K&R style indentation and
8-space tabs, that's what I get. If I prefer C++ style indentation and
4-space no-tabs, no problem.

You can convert from the XML markup to plain text, or HTML, or LaTeX, or
straight to postscript, or whatever format you like to read source in. You
can get syntax highlighting that isn't based on regexps, is fast and
actually *works*.

Yes, hacking XML by hand is no fun, and you'd want an editor or editor
plugin to cover it with a pretty interface so you could just get on with
writing code. But we wouldn't accept a dumb editor for writing
documentation, why do we accept it for writing code?

> Why should we just be locked into using XML? What if people do not know,
> or do not like XML?

No one is locked into using XML, it would merely be an additional
possibility. Out of all the programmers in the world, barely any of them
know or like logic programming. Yet that is hardly reason to cease Mercury
development :)

Michael

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list