[Mono-list] integrate python in mcs

A Rafael D Teixeira rafaelteixeirabr@hotmail.com
Thu, 25 Oct 2001 11:40:40 -0200


First, you donīt even need to use a parser generator if you donīt want to. 
What your parser class has to accomplish is to read the input stream of 
characters and generate the parsed tree on the also supplied rootcontext.

NOTE: Youīll have to code in C# to integrate into mcs, for the time being.

Your parser has to be a subclass of Mono.Languages.GenericParser, and 
implement the two virtual methods extensions() and parse(). If you do so, 
your parser will be automatically called for files ended with the extensions 
you return in the first method, by the driver logic.

Example:

namespace Mono.Languages.Python
{
	using System.Text;
	using System;
	using System.Collections;
	using CIR;
	using Mono.Languages;

	/// <summary>
	///    The Python Parser
	/// </summary>
	public class Parser : GenericParser {

		public override string[] extensions()
		{
			string [] list = { ".py" };
			return list;
		}

		public override int parse ()
		{
		  // Do your code here
		}
	} // end of class Mono.Languages.Python.Parser
} // end of namespace

Rafael Teixeira
Brazilian Developer


>From: Tobias Florek <tflorek@web.de>
>To: mono-list@ximian.com
>Subject: [Mono-list] integrate python in mcs
>Date: Thu, 25 Oct 2001 12:52:40 +0200
>
>hi
>
>thx miguel for your answer, i read something about bison and yacc, and 
>think
>that i am now ready to (begin to) think about python for .net seriously.
>
>in my opinion, its best to integrate python into mcs, as rafael is doing 
>with
>monobasic.
>i'll be in holiday next week and will take a copy of mcs' sourcecode with 
>me
>and see how python could fit into...
>
>brief guidance (how i could start... ) of you, rafael, is welcome, if you
>could post it in a day or so (i wont be able to check my mails afterwards 
>:-(
>anyway i'll go thru the code and will make conceptions...
>
>--
>
>Tobias Florek
>
>< born to code >
>
>_______________________________________________
>Mono-list maillist  -  Mono-list@ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-list


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp