[m-dev.] Mercury front ends

Ralph Becket rbeck at microsoft.com
Tue Jan 25 01:34:57 AEDT 2000


It sounds like what you want are syntax aware editors & tools
and are suggesting some instance of XML as a markup language.

1. Mercury programs (minus comments) are all parsable by the
term library, so if you wanted to write a Mercury -> XML
source translator it wouldn't be too hard.  You'd probably
want to add some preprocessing step so that comments can be
included in the output.

2. How do you propose to handle syntax errors in code?  While
I'm developing code, quite large chunks of it contain errors
(e.g. `XXX fill this in') that I am aware of and want to come
back to later.  I don't want my editor bollixing up the
presentation of the code just because of that.  Also, sometimes
one has to break with layout conventions in order to improve
code readability.  Would this even be possible in the scheme
you suggest?

3. Does one really spend that much time laying out source code?
For me the most aesthetic pain occurs when pred/mode/lambda
declarations take up more than one line - but it's hardly a
major time sink.

4. [Personal opinion]
I would like to see a literate programming environment for
Mercury (couldn't we just hack one of the existing systems?  
Someone must have a willing and able undergrad...)

Cheers,

Ralph

> -----Original Message-----
> From: Michael Day [mailto:mcda at cat.cs.mu.OZ.AU]
> Sent: 24 January 2000 14:15
> To: mercury-developers at cs.mu.OZ.AU
> Subject: Re: [m-dev.] Mercury front ends
> 
> 
> 
> > 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
> --------------------------------------------------------------
> ------------
> 
--------------------------------------------------------------------------
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