carbon-language / carbon-lang

Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)
http://docs.carbon-lang.dev/
Other
32.27k stars 1.48k forks source link

Roslyn like Compiler as Library/Service? Ease of Platform portability? #1528

Closed zezba9000 closed 2 years ago

zezba9000 commented 2 years ago

Does compiler allow it to be used in the lang itself and let me pull syntax from external projects? EXAMPLE: Carbon Subset => HLSL, GLSL, etc (aka custom GPU Shader program tools)

How portable is the LLVM IR or other bytecode that comes before to port to other systems. Is the code gen emitter built on top of LLVM or can LLVM be replaced with a different output? EXAMPLE: Carbon bytecode/codegen => C89 EXAMPLE: Carbon LLVM IR => C89 CONCERN: LLVM is far worse on AVR chips & embedded platforms vs GCC

One thing I love about C# is it supports all of the above. I can use Roslyn to make custom C# subsets that transpile into GPU Shader programs. I can take .NET bytecode from libraries and translate it into C89 with a custom runtime.

chandlerc commented 2 years ago

As we don't have a concrete compiler fully implemented yet, these questions may just be too early for us to usefully answer.

LLVM's IR is reasonably portable, but I also don't think anyone wants to end up with a language design that cannot be ported to other code generation layers.

At the moment, our focus is on actually reaching the MVP design and then implementation that lets us evaluate the direction of Carbon, and not so much on the detailed platform support story outlined here. So I think for now, this is probably "not planned". But if there is something you (or anyone else) thinks should be addressed in the short term, please re-open with details.

zezba9000 commented 2 years ago

At min I would stress exposing the compiler parts as libraries to be consumed in the language itself after bootstrapping earlier than later as the benefits can't be stressed enough. Locking a compiler so its only communication layer is STDIO as say Git-Core does is the biggest pain in the ass for tooling software.

Anyway thanks for response :)