Last active
October 1, 2016 11:59
-
-
Save grondilu/88f009105383b9c675d5702a489fa6b8 to your computer and use it in GitHub Desktop.
can a compiler be made as a chain of sub-compilers?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It is known that functional programming and -at the extreme- lambda-calculus is fundamentally equivalent to more conventional programming, involving sequential execution of statements and variable affectation. | |
For instance a code like: | |
my $x = foo(); | |
bar($x); | |
fiz($x); | |
can be written: | |
sub ($x) { sub { fiz($x) }(bar($x)) }(foo()); | |
which is very close to whatever would be its equivalent in lambda-calculus. | |
That got me wondering: would it be possible to create a compiler for a high-level programming language like Perl, from a series of trans-compilers for a chain of sub-languages. That is, starting from a very lisp-like language, making a compiler that would take a slightly more complicated language that would target the lisp-like one, and then an other compiler targetting that second language, and so on and so on? | |
Perl 6 currently uses a sub-language for its definition: NQP. Could it be feasible and desirable to increase the number of sublanguages and create a hierarchy of them that would start from a very lisp-like one? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment