Displaying 5 results from an estimated 5 matches for "curtok".
2010 Feb 17
2
[LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)
...y;
public:
FunctionAST(PrototypeAST *proto, ExprAST *body)
: Proto(proto), Body(body) {}
Function *Codegen();
};
//===----------------------------------------------------------------------===//
// Parser
//===----------------------------------------------------------------------===//
/// CurTok/getNextToken - Provide a simple token buffer. CurTok is the current
/// token the parser it looking at. getNextToken reads another token from the
/// lexer and updates CurTok with its results.
static int CurTok;
static int getNextToken() {
return CurTok = gettok();
}
/// BinopPrecedence - This...
2010 Feb 17
0
[LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)
...body)
> : Proto(proto), Body(body) {}
>
> Function *Codegen();
> };
>
>
> //===----------------------------------------------------------------------===//
> // Parser
>
> //===----------------------------------------------------------------------===//
>
> /// CurTok/getNextToken - Provide a simple token buffer. CurTok is the
> current
> /// token the parser it looking at. getNextToken reads another token from
> the
> /// lexer and updates CurTok with its results.
> static int CurTok;
> static int getNextToken() {
> return CurTok = getto...
2010 Feb 17
1
[LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)
...>>
>> Function *Codegen();
>> };
>>
>>
>> //===----------------------------------------------------------------------===//
>> // Parser
>>
>> //===----------------------------------------------------------------------===//
>>
>> /// CurTok/getNextToken - Provide a simple token buffer. CurTok is the
>> current
>> /// token the parser it looking at. getNextToken reads another token from
>> the
>> /// lexer and updates CurTok with its results.
>> static int CurTok;
>> static int getNextToken() {
>...
2019 Nov 18
2
Crash using exceptions
...unique_ptr<ExprAST> LogError(const char *Str) {
fprintf(stderr, "Error: %s\n", Str);
throw std::runtime_error("");
}
and I catch that exception in MainLoop:
static void MainLoop() {
while (true) {
fprintf(stderr, "ready> ");
try {
switch (CurTok) {
...
}
} catch (std::runtime_error &e) {
fprintf(stderr, "%s\n", e.what());
}
}
}
I compile with:
clang++ -g toy.cpp `llvm-config --cxxflags --ldflags --system-libs
--libs core orcjit native` -O3 -fexceptions -o toy
./toy
ready> var 3 = 2
ready> E...
2011 Feb 08
1
[LLVMdev] Question about linker error
...ExprAST *init)
: Name(name), Init(init) {}
virtual Value *Codegen();
};
/// Parser
/// ::= 'global' identifier ('=' expression)?
static ExprAST *ParseGlobalExpr() {
getNextToken();
std::string Name = IdentifierStr;
getNextToken();
ExprAST *Init = 0;
if (CurTok == '=') {
getNextToken();
Init = ParseExpression();
if (Init == 0) return 0;
}
return new GlobalExprAST(Name, Init);
}
Any help would be much appreaciated!
Anton