Coder Social home page Coder Social logo

learning-compiler-construction's People

Contributors

mxxxxxs avatar

learning-compiler-construction's Issues

编译流程

摘抄于一张 Compiler Construction: Principles and Practice 里的流程图

Source Code 源码
|
Scanner 代码扫描器, 读入代码
|
Tokens 输出一个个词
|
Parser解析每个词
|
Syntax Tree 生成语法分析树
|
Semantic Analyzer 语义分析
|
Annotated Tree 带语义注释的树
|
Source Code Optimizer 源码优化器
|
Intermediate Code 中间代码
|
Code Genrator 代码生成器
|
Target Code 目标代码
|
Target Code Optimizer 目标代码优化器
|
Target Code 目标代码

上下文无关语法

Compiler Construction Principles and Practice, 在第131页底部, 感觉言简意赅

We have been using the term context-free without explaining why such rules are in fact "free of context." The simple reason is that nonterminals appear by themselves to the left of the arrow in context-free rules. Thus a rule A->α says that A may be replaced by α anywhere, regardless of where the A occurs.

我们已经用了词: 上下文无关, 而没有解释为什么这样的规则事实上就是"和上下文没有关系的". 简单的理由是: 非终结符自身在上下文无关规则的箭头左边.
于是, 若有一条规则: A->α, 则意味着A可能会在任何地方被α替换, 无论A在什么位置出现.

平时说话经常会用代词指代东西, 代词就是上下文有关的, 不然无法判断其指代, 而某个名字往往就是上下文无关的, 这个名字直接被理解为其对应的事物

比如: 那个男人, 可以有多个理解, 需要上下文, 而就明确被大脑接收并替换为"书"这种东西

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.