summaryrefslogtreecommitdiffstats
path: root/llvm/docs/tutorial/LangImpl2.html
diff options
context:
space:
mode:
authorErick Tryzelaar <idadesub@users.sourceforge.net>2009-09-22 21:14:49 +0000
committerErick Tryzelaar <idadesub@users.sourceforge.net>2009-09-22 21:14:49 +0000
commit6e2b34bc14cccfc7194c6fec2e6b134cef64c129 (patch)
tree9cdb74c7b12d9363dce0d1f4246918689303d880 /llvm/docs/tutorial/LangImpl2.html
parentea9b03e6e23408325145ca089e4d7d6386b65a2d (diff)
downloadbcm5719-llvm-6e2b34bc14cccfc7194c6fec2e6b134cef64c129.tar.gz
bcm5719-llvm-6e2b34bc14cccfc7194c6fec2e6b134cef64c129.zip
Sync c++ kaleidoscope tutorial with test.
llvm-svn: 82572
Diffstat (limited to 'llvm/docs/tutorial/LangImpl2.html')
-rw-r--r--llvm/docs/tutorial/LangImpl2.html26
1 files changed, 14 insertions, 12 deletions
diff --git a/llvm/docs/tutorial/LangImpl2.html b/llvm/docs/tutorial/LangImpl2.html
index 30215608a8c..5bcd0dd2c7f 100644
--- a/llvm/docs/tutorial/LangImpl2.html
+++ b/llvm/docs/tutorial/LangImpl2.html
@@ -84,7 +84,7 @@ public:
class NumberExprAST : public ExprAST {
double Val;
public:
- explicit NumberExprAST(double val) : Val(val) {}
+ NumberExprAST(double val) : Val(val) {}
};
</pre>
</div>
@@ -107,7 +107,7 @@ in the basic form of the Kaleidoscope language:
class VariableExprAST : public ExprAST {
std::string Name;
public:
- explicit VariableExprAST(const std::string &amp;name) : Name(name) {}
+ VariableExprAST(const std::string &amp;name) : Name(name) {}
};
/// BinaryExprAST - Expression class for a binary operator.
@@ -333,9 +333,9 @@ static ExprAST *ParseIdentifierExpr() {
ExprAST *Arg = ParseExpression();
if (!Arg) return 0;
Args.push_back(Arg);
-
+
if (CurTok == ')') break;
-
+
if (CurTok != ',')
return Error("Expected ')' or ',' in argument list");
getNextToken();
@@ -833,7 +833,7 @@ enum Token {
tok_def = -2, tok_extern = -3,
// primary
- tok_identifier = -4, tok_number = -5,
+ tok_identifier = -4, tok_number = -5
};
static std::string IdentifierStr; // Filled in if tok_identifier
@@ -901,14 +901,14 @@ public:
class NumberExprAST : public ExprAST {
double Val;
public:
- explicit NumberExprAST(double val) : Val(val) {}
+ NumberExprAST(double val) : Val(val) {}
};
/// VariableExprAST - Expression class for referencing a variable, like "a".
class VariableExprAST : public ExprAST {
std::string Name;
public:
- explicit VariableExprAST(const std::string &amp;name) : Name(name) {}
+ VariableExprAST(const std::string &amp;name) : Name(name) {}
};
/// BinaryExprAST - Expression class for a binary operator.
@@ -1004,9 +1004,9 @@ static ExprAST *ParseIdentifierExpr() {
ExprAST *Arg = ParseExpression();
if (!Arg) return 0;
Args.push_back(Arg);
-
+
if (CurTok == ')') break;
-
+
if (CurTok != ',')
return Error("Expected ')' or ',' in argument list");
getNextToken();
@@ -1150,7 +1150,7 @@ static PrototypeAST *ParseExtern() {
//===----------------------------------------------------------------------===//
static void HandleDefinition() {
- if (FunctionAST *F = ParseDefinition()) {
+ if (ParseDefinition()) {
fprintf(stderr, "Parsed a function definition.\n");
} else {
// Skip token for error recovery.
@@ -1159,7 +1159,7 @@ static void HandleDefinition() {
}
static void HandleExtern() {
- if (PrototypeAST *P = ParseExtern()) {
+ if (ParseExtern()) {
fprintf(stderr, "Parsed an extern\n");
} else {
// Skip token for error recovery.
@@ -1169,7 +1169,7 @@ static void HandleExtern() {
static void HandleTopLevelExpression() {
// Evaluate a top-level expression into an anonymous function.
- if (FunctionAST *F = ParseTopLevelExpr()) {
+ if (ParseTopLevelExpr()) {
fprintf(stderr, "Parsed a top-level expr\n");
} else {
// Skip token for error recovery.
@@ -1207,7 +1207,9 @@ int main() {
fprintf(stderr, "ready&gt; ");
getNextToken();
+ // Run the main "interpreter loop" now.
MainLoop();
+
return 0;
}
</pre>
OpenPOWER on IntegriCloud