如何为我的编译器创建 GUI?

发布于 2024-08-17 17:45:02 字数 87 浏览 10 评论 0原文

我使用 flex 作为词法分析器,使用 bison 作为解析器生成器,但两者的结果都是 控制台窗口,我想要一个 GUI(比如 IDE) 那么该怎么做呢。 谢谢

i am using flex as lexical analyzer and bison as parser generator , but the result of both is
console window and i want to have a gui (like ide) for it
so how to do that .
thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

看春风乍起 2024-08-24 17:45:02

不。将编译器保留为命令行应用程序,而是教一些现有的 IDE 如何调用它并解析其输出。

Don't. Leave the compiler as a command line application and instead teach some existing IDE about how to call it and parse its output.

回眸一笑 2024-08-24 17:45:02

如果您将其保留为命令行,则可以使用开源 GUI 并将编译器插入其中 - 您可以免费获得适合您的编译器的出色 IDE ;)。

对于可以与自定义语言配合良好的 IDE:

您将在编写自己的代码时获得很多的乐趣无论如何,自定义插件,但它会比自己编写一个 IDE 少很多。

然而,另一个主题是为您的语言编写一个解释器,但我认为这不是您的目标。但是,如果是这样,您应该了解 readline

如果您真的确定要为您的语言编写一个简单 IDE(编写复杂的 IDE 是一项长期任务),请尝试至少使用一种语言它适合快速 GUI 开发(C#、Java 等),并为基础提供类似记事本的应用程序。你可以从那里开始。

但请记住,几乎所有已知的编译器都是命令行的——IDE 只是执行并解析结果。这是有原因的,你知道的。

使用命令行的原因:

  • 易于插入任何多用途 IDE
  • 易于自动化编译(makefile 等)
  • 易于自动化其他任务(批量构建、发布、部署、测试)

If you leave it as a command line, you can use Open Source GUI's and plug your compiler into it -- for free you get a brilliant IDE for YOUR compiler ;).

For IDE's that could go well with a custom language:

You'll have a lot of fun writing your custom plugins anyway, but it will be a lot less than writing an IDE yourself.

Another topic however, is writing an interpreter for your language, but I assume that's not what you are aiming for. If so however, you should learn about readline.

And if you're really sure you want to write a simple IDE for your language (writing a complex one is a task for ages), try to at least use a language that is suited for rapid GUI development (C#, Java, others), and get a working Notepad-like application for a base. You can start from there.

Remember however, that almost every known compiler is command-line -- the IDE's just execute and parse the results. There's a reason for that, y'know.

Reasons for command-line:

  • easy to plug into any multi-purpose IDE
  • easy to automate compilation (makefiles, etc)
  • easy to automate other tasks (batch-building, release, deployment, testing)
时光瘦了 2024-08-24 17:45:02

你使用什么操作系统?我假设linux bc我很难让bison在windows上运行,尽管我可以在windows中编译我的bison输出。

我没有 IDE。我在 VMWare 中安装了 linux,并启用了 Unity(因此我在 Windows7 Windows 上或下安装了 Linux Windows),并使用程序员记事本来编辑文件,作为我首选的简单 IDE。它有一些自动完成功能等。对于我的编译器的 Windows 版本,我可以将批处理文件设置为 pnotepad,在更改源代码时,我可以按 F5 运行 bat 文件并编译我的源代码并且它有输出。然而,在开发编译器时,我使用 alt-tab 切换到我的 Linux 终端并在那里运行构建。

当我在 Linux 上构建编译器时,它会运行自动脚本来查看是否有任何问题,并且我的 Linux 编译器会以不同的颜色构建输出错误。我不需要 IDE。我确实希望我能为视觉工作室提供某种我已经研究过的语言插件。看起来很困难,但这家伙在 Visual Studio 中使用 php 进行语法高亮 Visual Studio 2010 中是否支持本机 PHP?

What OS are you on? I'll assume linux bc i had difficulties getting bison running on windows although i can compile my bison output in windows.

I didnt have an IDE. I had linux in VMWare with unity on (so i had linux windows on or under windows7 windows) and used programmers notepad to edit the files as its my preferred simple IDE. It has some autocomplete and etc. For my windows build of my compiler i can set a batch file to pnotepad and while changing source i can press F5 which ran the bat file and compiled my source AND it had the output. However developing the compiler i used alt-tab to switch to my linux terminal and ran the build in there.

When i built the compiler on linux it would run automated scripts to see if anything broke and my linux compiler build output errors in a different color. I had no need for an IDE. I do hope i can have some kind of language plugin for visual studios which i already looked into. It looks difficult but this guy has syntax highlight with php in visual studios Native PHP support in Visual Studio 2010?

枕头说它不想醒 2024-08-24 17:45:02

详细阐述 Kornel 答案中的 Eclipse 部分;这里有一个关于如何教学的指南
Eclipse 将成为您的语言的 IDE:
http://www.eclipse.org/articles/article .php?file=Article-BuildYourOwnDSL/index.html

Elaborating on the Eclipse part of Kornel's answer; here's a pointer to how you can teach
Eclipse to be the IDE for YOUR language:
http://www.eclipse.org/articles/article.php?file=Article-BuildYourOwnDSL/index.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文