This may be a stupid question, and it would certainly take one Hell of a lexer, but do any extant programming languages allow you to do something like:

```
c# (1.2) {
    // c# code
}
Perl (5) {
    # perl code
    c# (2.0) {
        // some more c# code
    }
}

```

To utilize multiple languages in individual source files? I'm working on a design for a new language and want to allow something like this in it (basically out of sheer laziness, not wanting to port snippets copied and pasted from the web, older projects, or just for shits and giggles.)

In my research thus far it seems like hacking `gcc`'s intermediary language will be a good way to get it into optimized machine code with the least amount of effort, while the lexer is going to be a challenge (I've been playing around with an IntelliJ plugin for the language [again, laziness, as I'd prefer not to have to craft a whole IDE to put together a mockup of the editor for the language,] but have already hit a hard limit on the context-free nature of the Backus-Naur form of grammar notation, so it seems like this will have to take another format simply for the features I want in my own language without regard to others - making most of the JetBrains tutorials on the matter mostly useless as a result.) This in turn might be a bit of a blessing since it's a chance to abstract away the language definition to a degree with a sort of grammatical bootloader in the lexer and language specs included along the way - e.g. for the above pseudocode something like:

```
#require c#-1.2
#require Perl-5
#require c#-2.0

```

At the top of a given source file or somewhere within it's include chain (with my new language as the default and the grammar to build new grammar and parsing methods built into it to bootload the whole process lexically.

Anyway, back to the point: does anything like this already exist that I might use as a touchstone? Especially in relation to dynamical parsers and lexers (where the already-parsed code can change the interpretation of future code significantly - akin to redefining the whole language for a given context [block of code.])