[Mono-list] My own language with mono?

Michael B. Trausch mbt at zest.trausch.us
Fri Apr 17 21:51:33 EDT 2009


On Fri, 17 Apr 2009 18:28:54 -0700 (PDT)
BlueHawk204 <bluehawk204 at hotmail.com> wrote:

> I been wanting to write my own language and i was thinking about
> having it compile with mono. I know boo uses mono. How would have my
> code compile with mono? someone suggest outputting the bytecode but i
> dont want to optimize (and i imagine mono is loads better at it then
> i am) so what can i do?

Well, if you want to write your own language, I would say that
outputting bytecode is the best thing to do.  You do not necessarily
have to optimize it, just output it.

Your other option would be to output machine language... :-)

> I could output C# source (or C, or C++). I could also translate it to
> basic instructions like int a; a = 5; a+=6*2; into DECL INT a; A = 5;
> A += 6*2 (or REG = 6*2; A = A + REG;). What is the easiest way?
> 
> Am i posting this in the right section?

If you want to compile to another higher-level language, you can do
that.  There are plenty of languages that work that way, check out Vala
for an example of one (Vala is a C# like non-managed language which
compiles to C code).

It doesn't much matter if you compile to a high-level language or to
IL (which is, for all intents and purposes, high-level assembly
language).  Either way, you'll need to read the input program, parse
the syntax, give the syntax meaning, and output generated code.  If
you're generating lower-level code (e.g., IL) then you're going to have
more flexibility in what you can do in your language because you're
building the result with smaller building blocks, if that makes sense.

	--- Mike

-- 
The problem about Wikipedia is, that it just works in reality, not in
theory.
                            --- Stephen Colbert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-list/attachments/20090417/0c3501e2/attachment.bin 


More information about the Mono-list mailing list