Skip to main content
7 events
when toggle format what by license comment
Nov 12, 2020 at 3:41 comment added Joey Eremondi @mythbuster Extending a type system is not a trivial task. Learning the language that the compiler is implemented in is likely to be significantly less work than trying to patch together your own extension in a different language. If you're not comfortable enough with different languages to be able to write in whatever language the compiler is implemented in, you're probably not going to be comfortable enough with programming languages to be writing your own type system.
Nov 12, 2020 at 3:39 comment added Joey Eremondi You don't have to, but it's much easier if you do. One way to think of a type system is as a "filter": it reads a program, and either passes it on to the translating part of the compiler, or it fails with a type error message. So in principle, you can write your filter in any language you want, provided you interface with the rest of the compiler in some way (FFI? external process?). It's a bit more complicated in cases where the code generation depends on typing information coming from your type system i.e. if you have any form of type inference that guides compilation.
Nov 12, 2020 at 0:42 comment added mythbuster I’m talking about forking a compiler and then adding a new type system. Here do I need to use the same language as the compiler for implementation?
Nov 11, 2020 at 21:30 comment added Joey Eremondi @mythbuster what do you mean by "extending an existing language's type system?" Are you "forking" a compiler to make a new type system? What kind of extension do you mean? As for functional vs imperative, there is no technical reason you cannot implement a functional language with an imperative one or vice versa. It's just a matter of what is easy and what requires the least boilerplate. Basically, people us functional languages not because they have to, but because they want to.
Nov 11, 2020 at 20:09 comment added mythbuster If we are extending an existing language’s type systems, is it recommended to implement it in the current compiler’s language? Is there a way to combine this extended type system in a functional language with a compiler in an imperative language?
Nov 11, 2020 at 20:03 vote accept mythbuster
Nov 11, 2020 at 19:41 history answered Joey Eremondi CC BY-SA 4.0