Need help designing a translator

I'm thinking of making an undergrad project to create an interpreter for a simple / rudimentary user language (perl / C like). I would be happy if someone could point me in the right direction to start. Most of the books / resources that I find are devoted to the theoretical implementation of compilers. Are there any resources for translators? I'm going to implement it in C ++, but I have very little knowledge about the design of the interpreter, so any pointers to books / links will be appreciated

+3
source share
4 answers

Parsing the source code is not very different between the compiler and the interpreter. This is what most compiler tutorials are about.

+3
source

There are currently several useful tools for implementing custom languages.

You might want to check out Xtext in the Eclipse modeling package ( http://www.eclipse.org ) or MPS ( http://www.jetbrains.com/mps/ ), an IntelliJ toolkit language that is freely available.

Both allow you to create languages ​​and provide tools for generating code from a source and tools for creating code.

They also create abstract syntax trees that can be directly processed, i.e. executed. Then you have a translator.

bison/yacc lexer, , , antlr. , .

+2

- , .

+1

Uni. C, Lexx Yacc, , , Unix C. , , , .

http://www.lugbe.ch/action/reports/lex_yacc.pdf

+1

Source: https://habr.com/ru/post/1760317/


All Articles