<p>I want to make a language but I can't create all the libraries that are used in most programming languages. So I want to make a language that works in another language as a library (for example, pythonnet library for Python in .NET languages) I want to create a programming language library that is available for most modern popular programming languages. For example my programming language's name is ExfroProg and ExfroProg as ExfroC as C library, ExfroProg as ExfroC++ as a C++ library, ExfroProg as ExfroSharp as a C# library, ExfroProg as ExfroPy as a Python library and ExfroProg as ExfroJ as a Java library. So my first quesion what kind of idea is this?</p>
<p>I want to create a loader for my language to load all the classes and other things as ExfroProg classes, as ExfroProg thnigs to ExfroProg from the base languages like Python, C#, C++, Java that ExfroProg built in. So my second question is how much is it possible to do that? Is it possible to convert the base languages' all the stuffs to my ExfroProg stuffs?</p>
<p>Okay let's talk now more specific.
What the libraries do I need to use to make my built in language that is ExfroProg for Java, Python, C#, C++ and C?</p>

<language-design>
Making a Language as a Library That Runs in Another Language?
CC BY-SA 4.0
2023-07-25T19:00:22.423Z
this is possible, you probably need to focus on a C library and make bindings for other languages (see CPython, Lua, Embedded Common Lisp)
coredump
CC BY-SA 4.0
2023-07-25T19:01:29.970Z
*"So my first quesion what kind of idea is this?"* ─ This isn't a specific question. What do you mean, what kind of idea? *"So my second question is how much is it possible to do that?"* ─ Do you just mean "is it possible", or otherwise what specifically do you mean by "how much is it possible"? I suspect an answer like "yes, it is possible" would not be satisfactory, but then I don't know what other information you are seeking.
kaya3
CC BY-SA 4.0
2023-07-25T19:03:19.543Z
@kaya3-supportthestrike This question as you see is a general question. I couldn't ask more specific. But you can recommend the more specific question and I can edit it as to it
1 JustOnly 1
CC BY-SA 4.0
2023-07-25T19:06:51.670Z
@coredump Thanks for information. Is it possible to do that for Java by learning and using JNI (Java Native Interface). And I don't know how to do that for C# because I don't know C#'s native library like Java's native is JNI
1 JustOnly 1
CC BY-SA 4.0
2023-07-25T19:09:33.133Z
C#'s native library works the opposite way of the JNI: you write the glue code in C# rather than C.
Bbrk24
CC BY-SA 4.0
2023-07-25T19:19:30.377Z
There are a couple of very broad questions in here, but it’s unclear what kind of answer is expected. If you can try to [edit] down to a single concrete question it will help.
Michael Homer
CC BY-SA 4.0
2023-07-25T19:24:55.557Z
The edit doesn't really clarify what you are asking
mousetail 'he-him'
CC BY-SA 4.0
2023-07-25T19:25:02.583Z
Yes, any language can easily link with C libraries, but don't do everything at once, focus on the core language and if you have a working library and you publish it people may start writing the bindings
coredump
CC BY-SA 4.0
2023-07-25T20:09:58.663Z
Now It should be specific because I've edited to ask specific libraries for my goal. You can post an answer that explains the libraries do I need to use.
1 JustOnly 1
CC BY-SA 4.0
2023-07-25T21:02:07.043Z
Still not clear whether you want your language to produce libraries that other languages consume, or consume libraries others have written.
jmoreno
CC BY-SA 4.0
2023-07-26T00:53:24.733Z
Can your language simply convert the user code into C? Then everything available to C programs is automatically available to your programs.
Ray Butterworth
CC BY-SA 4.0
2023-07-26T02:42:21.310Z
You're basically reinventing Python or Lua. But more seriously, what's needed is a strong support for FFI.
Lie Ryan
CC BY-SA 4.0
2023-07-26T15:22:41.417Z
Implement your language on top of the .NET CLI (used to be MSIL, Microsoft Intermediate Language), and others can write their code in *any* .NET language. Otherwise, study the .NET CLI and attempt to copy it, because it does well what you want to accomplish. A similar target might be Java with it's JVM, with its own foundational intermediate Language. You might learn the JVM-based Clojure with its macros, and then you can build your language in Clojure. But Java is not built to host languages like .NET CLI. In addition to on Windows, The .NET CLI is available on Linux using the Mono framework
MicroservicesOnDDD
CC BY-SA 4.0
2023-07-26T15:46:33.237Z
As far as one language implemented inside another, it has been done with [the Forth programming language](https://en.m.wikipedia.org/wiki/Forth_(programming_language)) (these, Pascal, Basic, Scheme, StrongForth were implemented on different Forths) and is possible with [the Factor programming language](https://en.m.wikipedia.org/wiki/Factor_(programming_language)), which I strongly recommend. Many (most?} languages and virtual machines seem to be stack-based (or at least expressible that way), so it makes sense to choose a concatenative  language (stack language) upon which to build.
MicroservicesOnDDD
CC BY-SA 4.0
2023-07-26T16:44:47.920Z
Okay I decided to make my ExfroProg language with target programming langague's own. For example, ExfroPython will be made with Python as a library of Python that runs ExfroProg and loads everything ın Python into ExfroProg, and for other languages it will be made by this way.
1 JustOnly 1
CC BY-SA 4.0
2023-07-29T14:04:09.593Z
It sounds like you are making a ExfroProg *interpreter* in Python. Then the interpreter has easy access to the libraries in the host language.
Criticize SE actions means ban
# Making a Language as a Library That Runs in Another Language?
Posted by: username_0 on 2023-07-25
I want to make a language but I can't create all the libraries that are used in most programming languages. So I want to make a language that works in another language as a library (for example, pythonnet library for Python in .NET languages) I want to create a programming language library that is available for most modern popular programming languages. For example my programming language's name is ExfroProg and ExfroProg as ExfroC as C library, ExfroProg as ExfroC++ as a C++ library, ExfroProg as ExfroSharp as a C# library, ExfroProg as ExfroPy as a Python library and ExfroProg as ExfroJ as a Java library. So my first quesion what kind of idea is this?

I want to create a loader for my language to load all the classes and other things as ExfroProg classes, as ExfroProg thnigs to ExfroProg from the base languages like Python, C#, C++, Java that ExfroProg built in. So my second question is how much is it possible to do that? Is it possible to convert the base languages' all the stuffs to my ExfroProg stuffs?

Okay let's talk now more specific.
What the libraries do I need to use to make my built in language that is ExfroProg for Java, Python, C#, C++ and C?
**Tags:** language-design
> **Comments:**
> **username_1**: this is possible, you probably need to focus on a C library and make bindings for other languages (see CPython, Lua, Embedded Common Lisp)  
> **username_2**: *"So my first quesion what kind of idea is this?"* ─ This isn't a specific question. What do you mean, what kind of idea? *"So my second question is how much is it possible to do that?"* ─ Do you just mean "is it possible", or otherwise what specifically do you mean by "how much is it possible"? I suspect an answer like "yes, it is possible" would not be satisfactory, but then I don't know what other information you are seeking.  
> **username_0**: @kaya3-supportthestrike This question as you see is a general question. I couldn't ask more specific. But you can recommend the more specific question and I can edit it as to it  
> **username_0**: @coredump Thanks for information. Is it possible to do that for Java by learning and using JNI (Java Native Interface). And I don't know how to do that for C# because I don't know C#'s native library like Java's native is JNI  
> **username_3**: C#'s native library works the opposite way of the JNI: you write the glue code in C# rather than C.  
> **username_4**: There are a couple of very broad questions in here, but it’s unclear what kind of answer is expected. If you can try to [edit] down to a single concrete question it will help.  
> **username_5**: The edit doesn't really clarify what you are asking  
> **username_1**: Yes, any language can easily link with C libraries, but don't do everything at once, focus on the core language and if you have a working library and you publish it people may start writing the bindings  
> **username_0**: Now It should be specific because I've edited to ask specific libraries for my goal. You can post an answer that explains the libraries do I need to use.  
> **username_6**: Still not clear whether you want your language to produce libraries that other languages consume, or consume libraries others have written.  
> **username_7**: Can your language simply convert the user code into C? Then everything available to C programs is automatically available to your programs.  
> **username_8**: You're basically reinventing Python or Lua. But more seriously, what's needed is a strong support for FFI.  
> **username_9**: Implement your language on top of the .NET CLI (used to be MSIL, Microsoft Intermediate Language), and others can write their code in *any* .NET language. Otherwise, study the .NET CLI and attempt to copy it, because it does well what you want to accomplish. A similar target might be Java with it's JVM, with its own foundational intermediate Language. You might learn the JVM-based Clojure with its macros, and then you can build your language in Clojure. But Java is not built to host languages like .NET CLI. In addition to on Windows, The .NET CLI is available on Linux using the Mono framework  
> **username_9**: As far as one language implemented inside another, it has been done with [the Forth programming language](https://en.m.wikipedia.org/wiki/Forth_(programming_language)) (these, Pascal, Basic, Scheme, StrongForth were implemented on different Forths) and is possible with [the Factor programming language](https://en.m.wikipedia.org/wiki/Factor_(programming_language)), which I strongly recommend. Many (most?} languages and virtual machines seem to be stack-based (or at least expressible that way), so it makes sense to choose a concatenative  language (stack language) upon which to build.  
> **username_0**: Okay I decided to make my ExfroProg language with target programming langague's own. For example, ExfroPython will be made with Python as a library of Python that runs ExfroProg and loads everything ın Python into ExfroProg, and for other languages it will be made by this way.  
> **username_10**: It sounds like you are making a ExfroProg *interpreter* in Python. Then the interpreter has easy access to the libraries in the host language.  
---
## 0 answers
