liancheng / llvm-tutorial-cn Goto Github PK
View Code? Open in Web Editor NEWSimplified Chinese translation for the LLVM Tutorial
Home Page: https://llvm-tutorial-cn.readthedocs.org/en/latest/
Simplified Chinese translation for the LLVM Tutorial
Home Page: https://llvm-tutorial-cn.readthedocs.org/en/latest/
友情提醒:想看后面章节的同学可以看下这个仓库:
https://github.com/Hanseltu/kaleidoscope-tutorial
在第二章中提到:
下一条生成规则也很简单,它负责处理变量引用和函数调用:
.. literalinclude:: _includes/chapter-2_full.cpp :language: cpp :lines: 172-198
代码如下:
/// identifierexpr
/// ::= identifier
/// ::= identifier '(' expression* ')'
static ExprAST *ParseIdentifierExpr() {
std::string IdName = IdentifierStr;
getNextToken(); // eat identifier.
if (CurTok != '(') // Simple variable ref.
return new VariableExprAST(IdName);
// Call.
getNextToken(); // eat (
std::vector<ExprAST*> Args;
if (CurTok != ')') {
while (1) {
ExprAST *Arg = ParseExpression();
if (!Arg) return 0;
Args.push_back(Arg);
if (CurTok == ')') break;
if (CurTok != ',')
return Error("Expected ')' or ',' in argument list");
getNextToken();
}
}
在前几条规则中,函数都有return语句,那么对于词条规则的代码描述,是不是应该加上如下几行:
// Eat the ')'.
getNextToken();
return new CallExprAST(IdName, Args);
}
应该对应172-204行代码。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.