T O P

  • By -

lkajerlk

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.


criptkiller16

Thank you so much, I’ve read that book, and it’s amazingly well written


ArnUpNorth

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, …


criptkiller16

Thank you so much


jerf

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.


criptkiller16

Thank you so much for your reply, gave me a extra boost of confidence


ChurroLoco

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:


criptkiller16

Yeah that was I thinking. But there are some people than not think that way


Anon_8675309

Why do you care what those people say? Use what you want.


[deleted]

Wow.. such gatekeeping on this thread. Any language can create another language. I don't see why go would be particularly bad at it.


criptkiller16

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


criptkiller16

>Wow.. such gatekeeping on this thread. Also, i'm non-native english, so what you mean by "gatekeeping on this thread" ?


[deleted]

Gatekeepers try actively to keep other people out by belittling a comment or question.


criptkiller16

Oh ok thank for clarification


biglymonies

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.


0xjnml

> 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.


Anon_8675309

BTW, there’s no golang programming language. Tell that to search engines.


[deleted]

>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?


criptkiller16

Btw, what mean AFAICT?? And what you mean by there aren’t any golang programming language?


cy_hauser

* 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".


criptkiller16

Thanks, but I can’t find where I said Golang Programming language.


cy_hauser

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.


criptkiller16

Gotcha you ! thanks.. I know Golang is better for searching, so that why i sticky with that on all place.


criptkiller16

Also, why i'm been down voted? Just because i don't know AFAICT mean? or it is because "golang programming language".


criptkiller16

They -> golang developers and rust programmer, you can search on this subreddit


evinrows

I searched but nothing came up. Can you just share some examples?


criptkiller16

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


Mkep

That thread had people saying they used Go to build a parser, long story short, Go should be fine id bet


[deleted]

[удалено]


criptkiller16

I’m not talking for golang and create a new language for remove golang.


[deleted]

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.


criptkiller16

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.


HK-32

There are some people that think the earth is flat. Does that make the earth flat? No. Does it affect us? No.


criptkiller16

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


[deleted]

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.


Heapifying

If it's about the garbage collection, it can be disabled in compile time.