Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Easy Way to Create Language Service for Hybrid Languages?

$
0
0

A hybrid language is a language that consists of multiple sub-languages.

My question has to do with 2 kinds of hybrid language:

1. Sub-languages are nicely isolated and don't interact with each other

Like MarkDown, other languages are encapsulated in code blocks and have absolutely nothing to do with other stuffs in the code.

# Title

One day I was writing a document with MarkDown happily. But suddenly:

```cs
// I have to insert a C# code block
var codeBlock = new CodeBlock();
```

2. Opposite to case 1 

Let's say one of the language's assignment syntax takes another language's expression/code block as valid right-hand-side value. Like:

VARIABLE_IN_LANGUAGE_FOO = new ConstructorCallInCSharp(args);

VARIABLE_IN_LANGUAGE_FOO = Expression + In / C * Sharp;

So in both cases, if possible, how do I do the following task(to simplify the question, we have a DSLFoo that hybrid with C#):

1. Syntax coloring for C# code fragments

2. Syntax error checking for C# code fragments

3. Intelligence sense for C# code fragments (In case 1, without constraint. In case 2, the expression's return type is constraint)

Is it possible to just make use of C#'s language service somehow, without writing my own scanner/parser for C#?

(Take Emacs for example, you can actually combine multiple existing language modes with a small amount of code to provide language service for a hybrid language. Something like that.)  

Thanks.


Code for fun, not for food.






Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>