Groovy (52)

47 Name: #!/usr/bin/anonymous : 2008-10-29 14:40 ID:uce3/Oi8

> Reflection.Emit only works for a language already running on .Net. You cannot use it to implement your newly created language.

Of course you can. In fact, it's the best way to make interactive languages on .Net.

> You continue to think you know what you are talking about but you do not. One does not write opcodes to a text file. They would write the assembly language mnemonics to a text file.

You're splitting hairs, but you're still wrong. Interactive compilers do not write the mnemonics to a text file. They generate the assembly in-memory and run it directly.

> So this magical compiler for a language I just created can be parsed by .Net and generate the CIL code magically. WOW!

Perhaps you've never written a compiler for .Net; you've certainly not written an interactive one. There's nothing magical about it, and you can learn a lot by doing so. Forth compilers are especially simple, and can be written by a third or fourth year CS student in an afternoon, so I'd recommend trying that.

.Net doesn't "parse" anything. Compilers like C#'s compiler consist of non-compiling parts such as the lexer, the parser, and any AST-generating components that are in there. The "compiling" part simply serializes the AST into some machine (or virtual machine) bytestream.

In Lisp, you don't need a lexer or a parser because the data structure you write in is the AST. That's why the definition of compile has to be carefully chosen to exclude the non-compiling parts.

Writing a .Net compiler can be done entirely threaded (using calls only) using Reflection.Emit. It's also very easy to do.

> You are contending that any given machine (real or virtual) should have 1 first class high level language to program on it (and a couple 3rd world ones).

I contend nothing of the sort. Citation needed.

I do howerver think your notion of first-classness is misplaced. Java's semantics are tied closely to it's virtual machine- Java doesn't have a GOTO so the virtual machine doesn't have a GOTO- and that means tail-recursion optimization is harder.

.NET's semantics aren't modeled on the virtual machine, but on a hypothetical CPU that could also process Java's semantics. As a result, it tends to not be as well-optimized, but it does make implementing many semantics easier.

Of course, it doesn't make all semantics easier, just fortunately those semantics tend to be hard to implement on real hardware as well so few people mind.

> hahaha wow thats not how that works. If I name it .txt it opens in Notepad. That doesn't mean that my .txt file is the Notepad program.

That exactly how it works. You load that .txt into memory, and point %eip at it, it will run.

> Standard low level code modification. Many languages.

These aren't complete sentences. Your point is that IL bytecodes are significantly better than JVM bytecodes because of STandard low level code modification?

That's gibberish.

And as many people have pointed out, there are many languages on the JVM as well.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification: