Displaying 4 results from an estimated 4 matches for "gettokprecedence".
2012 May 14
0
[LLVMdev] Fwd: Tiny bug in Kaleidoscope sample (FALSE ALARM)
...-----
From: Mikael Lyngvig <mikael at lyngvig.org>
Date: 2012/5/14
Subject: Tiny bug in Kaleidoscope sample
To: llvmdev at cs.uiuc.edu
Hi,
As far as I can tell, there's a tiny error in the sample code for the
Kaleidoscope interpreter, which is part of the Tutorial:
1. The function GetTokPrecedence() returns -1 on error (i.e. if the
input character is a character value above 127).
2. The caller of GetTokPrecedence() never checks for this so if the
input character is an 8-bit character, it is treated as a valid binary
operator.
I know this won't make the planet explode and that mankin...
2010 Feb 17
2
[LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)
...ds another token from the
/// lexer and updates CurTok with its results.
static int CurTok;
static int getNextToken() {
return CurTok = gettok();
}
/// BinopPrecedence - This holds the precedence for each binary operator that is
/// defined.
static std::map<char, int> BinopPrecedence;
/// GetTokPrecedence - Get the precedence of the pending binary operator token.
static int GetTokPrecedence() {
if (!isascii(CurTok))
return -1;
// Make sure it's a declared binop.
int TokPrec = BinopPrecedence[CurTok];
if (TokPrec <= 0) return -1;
return TokPrec;
}
/// Error* - These are little...
2010 Feb 17
0
[LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)
...ok with its results.
> static int CurTok;
> static int getNextToken() {
> return CurTok = gettok();
> }
>
> /// BinopPrecedence - This holds the precedence for each binary operator
> that is
> /// defined.
> static std::map<char, int> BinopPrecedence;
>
> /// GetTokPrecedence - Get the precedence of the pending binary operator
> token.
> static int GetTokPrecedence() {
> if (!isascii(CurTok))
> return -1;
>
> // Make sure it's a declared binop.
> int TokPrec = BinopPrecedence[CurTok];
> if (TokPrec <= 0) return -1;
> return TokP...
2010 Feb 17
1
[LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)
...Tok;
>> static int getNextToken() {
>> return CurTok = gettok();
>> }
>>
>> /// BinopPrecedence - This holds the precedence for each binary operator
>> that is
>> /// defined.
>> static std::map<char, int> BinopPrecedence;
>>
>> /// GetTokPrecedence - Get the precedence of the pending binary operator
>> token.
>> static int GetTokPrecedence() {
>> if (!isascii(CurTok))
>> return -1;
>>
>> // Make sure it's a declared binop.
>> int TokPrec = BinopPrecedence[CurTok];
>> if (TokPrec <=...