• Home
  • Raw
  • Download

Lines Matching refs:unary

49 The two specific features we'll add are programmable unary operators
50 (right now, Kaleidoscope has no unary operators at all) as well as
55 # Logical unary not.
56 def unary!(v)
84 implementing support for user-defined binary operators and adding unary
91 our current framework. We'll first add support for the unary/binary
107 if (IdentifierStr == "unary") return tok_unary;
110 This just adds lexer support for the unary and binary keywords, like we
155 operators (as you'll see below, it just doesn't apply for unary
167 unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary.
291 the previous framework we built for other operators. Adding unary
298 Since we don't currently support unary operators in the Kaleidoscope
300 simple support for the 'unary' keyword to the lexer. In addition to
305 /// UnaryExprAST - Expression class for a unary operator.
317 we need to add the parsing logic. Parsing a unary operator is pretty
322 /// unary
324 /// ::= '!' unary
330 // If this is a unary operator, read it.
338 The grammar we add is pretty straightforward here. If we see a unary
340 prefix and parse the remaining piece as another unary operator. This
341 allows us to handle multiple unary operators (e.g. "!!x"). Note that
342 unary operators can't have ambiguous parses like binary operators can,
352 /// ::= ('+' unary)*
355 // Parse the unary expression after the binary operator.
361 /// ::= unary binoprhs
370 With these two simple changes, we are now able to parse unary operators
372 prototypes, to parse the unary operator prototype. We extend the binary
380 /// ::= unary LETTER (id)
384 unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary.
398 return ErrorP("Expected unary operator");
399 FnName = "unary";
407 As with binary operators, we name unary operators with a name that
410 unary operators. It looks like this:
418 Function *F = TheModule->getFunction(std::string("unary")+Opcode);
420 return ErrorV("Unknown unary operator");
457 # Logical unary not.
458 def unary!(v)
465 def unary-(v)
812 if (IdentifierStr == "unary") return tok_unary;
873 /// UnaryExprAST - Expression class for a unary operator.
1132 /// unary
1134 /// ::= '!' unary
1140 // If this is a unary operator, read it.
1149 /// ::= ('+' unary)*
1164 // Parse the unary expression after the binary operator.
1182 /// ::= unary binoprhs
1194 /// ::= unary LETTER (id)
1198 unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary.
1212 return ErrorP("Expected unary operator");
1213 FnName = "unary";
1308 Function *F = TheModule->getFunction(std::string("unary")+Opcode);
1310 return ErrorV("Unknown unary operator");