Concepts required in building an IDE/compiler [clo

2019-01-30 02:44发布

When it comes to making an IDE (e.g. SharpDevelop) or a compiler/language parser, what topics of computer science do I need to know? I don't expect a full list of in depth tutorials but just a list of topics which would benefit me in improving.

Am I right in thinking a parser has some rules about the syntax/semantics of a language, and validates the code based on these rules? That seems like a simple approach?

Thanks

6条回答
祖国的老花朵
2楼-- · 2019-01-30 03:01

If you're writing a compiler, a good Computer Science course in Theory of Language Translation or something similar is pretty much essential. MIT Open Courseware offers a "Computer Language Engineering" class along those lines. That should teach you the concept that mmattax mentions and provide a good start.

As for an IDE, that's really more of a desktop application project. You might be calling a compiler from your IDE, but you're not actually compiling code (though, to be fair, in a sophisticated IDE, you might be parsing code). So the knowledge required to build an IDE that calls an external compiler/linker would be more centered around the UI toolkit of whatever platform you're using, with perhaps a bit of compiler front-end theory (as you would learn in a compiler course) if you want to parse code.

查看更多
贪生不怕死
3楼-- · 2019-01-30 03:04

An IDE, a compiler and a debugger are three different beasts.

Here's a quick and slightly random selection of some links that I've found interesting or inspiring when thinking about building modeling tools for simulation languages, which is as close as I get to IDE:

There's somewhat of a bias in those links towards patterns to help reading and browsing rather than writing code, and towards systems the user extends while using them rather than as a separate cycle; if you want a task-oriented interface or static plugins, projects for existing IDEs such as Eclipse are the place to look.

查看更多
孤傲高冷的网名
4楼-- · 2019-01-30 03:05

For implementing a compiler / language, you will need a fundamental understanding of:

  • BNF & EBNF - Context-Free Grammers (the syntax rules)
  • Lexical Analyzing Techniques & Tools (Lex / Bison)
  • Parsing Techniques (eg. Recursive Decent, LL, LR)
查看更多
别忘想泡老子
5楼-- · 2019-01-30 03:19

Writing Compilers and Interpreters: A Software Engineering Approach [Paperback] Ronald Mak -> this is a great book to get started with. It leads you through the whole process of building a compiler and an ide with a debugger and many other things you need. At the end of the book you will have a good sense of what to do to branch out on your own.

You may also want to look at Language Implementation Patters by PragProg.com publishing too.

查看更多
一纸荒年 Trace。
6楼-- · 2019-01-30 03:19

Sorry but the answer is "The whole of computer science and years of practical experience".

Its too big a subject for ordinary mortals and eclipse, intellij, netbeans and Visual... have the subject pretty well covered.

Look at something smaller and more achievable like an eclipse plugin for something that interests you.

查看更多
ゆ 、 Hurt°
7楼-- · 2019-01-30 03:21

well in order to develop a compiler you need to grasp following topics

  • finite automate (DFA)
  • context-free grammar (you need to define a grammar before you start coding, it's a blue print of your language/compiler )

after done with theoretical part then you need develop following components for you compiler

  1. Lexical Analyzer (validate tokens for you language)
  2. Parser (validate sentences of you language)
  3. Translation Scheme (convert your code (high level ) into 3 address code (machine language code ))
  4. Virtual Machine (code Generation / produce actual out put of your code)

Note : out put of each component is input to next component and input of Lexical Analyzer is your actual code and mostly compiler is developed using Formal Method (a procedural design pattern)

查看更多
登录 后发表回答