2

I’m working on a small project and main purpose of the project is to create a compiler for numerical liner algebra. The approach I’m planning is,

  1. Create the Compiler in Java Programming language
  2. That will generate native assembly codes
  3. I Will be using an excising numerical linear algebra package (written in C) and will link with the assembly code generated by the compiler.

Furthermore, I’m thinking to support multithreading in the new language I’m going to create.

I’m very new to the assembly language and having the following questions.

  1. In order to support multithreading, do I need to use a separate threading library or is it necessary to do it by using generated assembly code?
  2. Since I’m developing this in the windows platform, is it worthwhile to develop this in C# language and generate CLR, IL instead of generating native assembly language.

Thanks,

Upul

Upul Bandara
  • 5,973
  • 4
  • 37
  • 60

2 Answers2

4

it might be best to generate the "compiled" output first as C code and use a C compiler to generate the assembly code

this is much easier to develop than direct to assembler because you can examine the intermediate code for errors and you don't have to worry about linking the package into the generated code as that will be done by the compiler

ratchet freak
  • 47,288
  • 5
  • 68
  • 106
1

The answer on 1. already presupposes that your choice of assembler is a good one. But I would strongly discourage it on the following ground:

Nowadays, assembler cannot beat anymore an optimized program written in a language like C, or C++ or maybe D. But, as a compiler writer you save yourself enomous trouble by generating output in such a language instead of assembler. Not the least of it: You're not fixed to a si8ngle platform.

When you make a decision on this, your first question is then transformed to: "(How) Does my target language support multithreading?"

Ingo
  • 36,037
  • 5
  • 53
  • 100