Create a programming language with C #

First of all, I need a programming language for the interaction between the code and my application environment and my goal. I wrote something like interpreters that simply know if , void and function , variables with their areas and, of course, call built-in functions that all of them work fine. But now I am stuck on some parts and understand that I cannot continue just simple parsing of the text, and there are many things that I cannot do.

So, for this I was looking for this topic, and I got Creating a programming language using C # . It was perfect, but I have two problems.

  • I do not understand this.
  • It generates console codes, but I want to use them in winapps.

In short, does anyone know how I can make my own language without taking courses like lexer, thinking ...

Thanks.

+8
c # programming-languages
source share
3 answers
+6
source share

I am not sure if I really understand your question.

Is this an extension of your program? A collection of library functions written in C #?

Or a completely separate language in which you write an interpreter in C #? (which I guess)

If this is the last, in the good old days, I would point you to Lex / Yacc (GIYF).

Now I can only say ANTLR. Check out the Five Minute Introduction to ANTLR 3 and ANTLR v3 C # Code Generator and Runtime Library

Just view the IDE screenshots on this page.

enter image description here

enter image description here

+4
source share

Creating your own language is possible, but very difficult. You can't do it well, can you, like lexers.

Creating your own language also forces your customers to learn another language, and no third-party code or libraries will exist for this intended language.

An alternative would be to implement an existing language and expose your application functionality through this. Python is one very common choice for embedding, but there are many other options. I highly recommend that you consider embedding an existing language for this task, rather than inventing your own.

+2
source share

All Articles