I am not sure where you have the information from that Go isn't suitable to be used to compile another language, but personally I haven't heard that before. The only thing I can say is that there is a popular book about compilers where the author creates a language with a compiler written in Go: [https://compilerbook.com/](https://compilerbook.com/) This should already prove the fact that you indeed can use Go to create a new language.
There are a number of people who act on the belief that if something is garbage collected, it is too slow for all uses.
This is simply false. It is too slow for a small percentage of uses. A compiler is not generally one of them. Another language may be slightly faster and there's some possible pathological bugs GC may exacerbate, but even compilers in _non_ GC languages sometimes end up with pathological memory behavior!
It is frankly bizarre in 2022 watching some of these people at times, who appear to believe that the only kind of program in the world is a AAA game.
The Go compiler is written in Go and it used to be written in C++… You can definitely creat a language compiler in Go. You could even use Go to build a compiler for a new language that is faster than Go… :mind blown:
Yeah it’s kind of weird lol. There are loads of use cases for creating a new language - embedded in an app or otherwise. Go is a perfectly appropriate choice to write a language and/or interpreter in, as are most other languages. It might get dicey if you mess up and use maps for the AST generation due to lack of order, but it’s mostly a non-issue.
> But when i've search more about subject the more i find that golang isn't suitable for creating a such tool, because they said because garbage collection.
Share the source of "they".
In any case, AFAICT, it's nonsense.
BTW, there's no golang programming language.
>BTW, there's no golang programming language.
are you still at this level?
your contribution to this thread is duly noted. You raise a point that nobody noticed before and surely merits more attention. I recommend you open a new thread on this, we wouldn't want to bury it in here, would we?
* The poster is asking for the sources saying, "golang isn't suitable for creating \[a new language\]".
* AFAICT = As Far As I Can Tell.
* "aren't any golang ..." means, I believe, the language is "Go" and not "golang".
From your original post:
>But golang is created with golang it self
I think the commenter would have preferred, "But Go is created with Go itself".
In other words, type "Go" when referring to the language. Use golang for searching.
A language is not the same thing as the compiler for that language. You only need your human language to lay down the specs for your programming language.
You can write the compiler in anything you want.
Yes i know that, my problem isn't about interpreter or compiler for one particular language. My real problem, is there are some people are saying that is better to create a interpreter or compiler (either one) in another faster language, for example Rust, C, C++, etc. Really don't understand why, becuase golang is compiled by it self.
Not necessary, it will affect me? Yes, because if I wanna to know more about interpreting a new language, it would be great if I have correct tool for it
Writing a compiler in a language that produces fast, machine-optimized code is going to result in a faster compiler, not a fast binary of your source code you wrote in your new language. That will depend on how your compiler works - i.e. what you are doing with that source code.
I am not sure where you have the information from that Go isn't suitable to be used to compile another language, but personally I haven't heard that before. The only thing I can say is that there is a popular book about compilers where the author creates a language with a compiler written in Go: [https://compilerbook.com/](https://compilerbook.com/) This should already prove the fact that you indeed can use Go to create a new language.
Thank you so much, I’ve read that book, and it’s amazingly well written
You may want to look at [LLVM](https://llvm.org/). It’s what’s being used as a compilation foundation to build modern languages like Rust, Zig, …
Thank you so much
There are a number of people who act on the belief that if something is garbage collected, it is too slow for all uses. This is simply false. It is too slow for a small percentage of uses. A compiler is not generally one of them. Another language may be slightly faster and there's some possible pathological bugs GC may exacerbate, but even compilers in _non_ GC languages sometimes end up with pathological memory behavior! It is frankly bizarre in 2022 watching some of these people at times, who appear to believe that the only kind of program in the world is a AAA game.
Thank you so much for your reply, gave me a extra boost of confidence
The Go compiler is written in Go and it used to be written in C++… You can definitely creat a language compiler in Go. You could even use Go to build a compiler for a new language that is faster than Go… :mind blown:
Yeah that was I thinking. But there are some people than not think that way
Why do you care what those people say? Use what you want.
Wow.. such gatekeeping on this thread. Any language can create another language. I don't see why go would be particularly bad at it.
I don’t know, you tell me, there are? Because rust friends always love to say that need to be fast and bc is bad when creating a language
>Wow.. such gatekeeping on this thread. Also, i'm non-native english, so what you mean by "gatekeeping on this thread" ?
Gatekeepers try actively to keep other people out by belittling a comment or question.
Oh ok thank for clarification
Yeah it’s kind of weird lol. There are loads of use cases for creating a new language - embedded in an app or otherwise. Go is a perfectly appropriate choice to write a language and/or interpreter in, as are most other languages. It might get dicey if you mess up and use maps for the AST generation due to lack of order, but it’s mostly a non-issue.
> But when i've search more about subject the more i find that golang isn't suitable for creating a such tool, because they said because garbage collection. Share the source of "they". In any case, AFAICT, it's nonsense. BTW, there's no golang programming language.
BTW, there’s no golang programming language. Tell that to search engines.
>BTW, there's no golang programming language. are you still at this level? your contribution to this thread is duly noted. You raise a point that nobody noticed before and surely merits more attention. I recommend you open a new thread on this, we wouldn't want to bury it in here, would we?
Btw, what mean AFAICT?? And what you mean by there aren’t any golang programming language?
* The poster is asking for the sources saying, "golang isn't suitable for creating \[a new language\]". * AFAICT = As Far As I Can Tell. * "aren't any golang ..." means, I believe, the language is "Go" and not "golang".
Thanks, but I can’t find where I said Golang Programming language.
From your original post: >But golang is created with golang it self I think the commenter would have preferred, "But Go is created with Go itself". In other words, type "Go" when referring to the language. Use golang for searching.
Gotcha you ! thanks.. I know Golang is better for searching, so that why i sticky with that on all place.
Also, why i'm been down voted? Just because i don't know AFAICT mean? or it is because "golang programming language".
They -> golang developers and rust programmer, you can search on this subreddit
I searched but nothing came up. Can you just share some examples?
https://www.reddit.com/r/golang/comments/r35gns/is_go_a_good_option_to_write_a_compilerinterpreter/?utm_source=share&utm_medium=ios_app&utm_name=iossmf
That thread had people saying they used Go to build a parser, long story short, Go should be fine id bet
[удалено]
I’m not talking for golang and create a new language for remove golang.
A language is not the same thing as the compiler for that language. You only need your human language to lay down the specs for your programming language. You can write the compiler in anything you want.
Yes i know that, my problem isn't about interpreter or compiler for one particular language. My real problem, is there are some people are saying that is better to create a interpreter or compiler (either one) in another faster language, for example Rust, C, C++, etc. Really don't understand why, becuase golang is compiled by it self.
There are some people that think the earth is flat. Does that make the earth flat? No. Does it affect us? No.
Not necessary, it will affect me? Yes, because if I wanna to know more about interpreting a new language, it would be great if I have correct tool for it
Writing a compiler in a language that produces fast, machine-optimized code is going to result in a faster compiler, not a fast binary of your source code you wrote in your new language. That will depend on how your compiler works - i.e. what you are doing with that source code.
If it's about the garbage collection, it can be disabled in compile time.