如何从自上而下的解析器构建AST或CST,以及如何使用它将源代码转换为中间语言 [英] How to build an AST or a CST from a top-down parser and how to use it for converting source code into an intermediate language

查看:493
本文介绍了如何从自上而下的解析器构建AST或CST,以及如何使用它将源代码转换为中间语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个编译器,我在构建抽象语法树并将其用于中间代码生成器时遇到一些问题。
有没有人有一些参考或一些可以帮助我的建议? >这是我和朋友们一起编写的编译器的存储库
https://github.com/team-reframe/Behemoth/tree/develop



我尝试过:



在github中搜索源代码并阅读大量书籍

Hi, i'm developing a compiler and i'm having some problems building the abstract syntax tree and using it for the intermediate code generator.
Does anyone have some references or some advices which could help me?
This is the repository of the compiler that I'm writing with my friends
https://github.com/team-reframe/Behemoth/tree/develop

What I have tried:

Seeked source code in github and read a lot of books

推荐答案

参见 LEX& YACC页面 [ ^ ]。


这篇关于如何从自上而下的解析器构建AST或CST,以及如何使用它将源代码转换为中间语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆