Lines Matching full: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
111 if (IdentifierStr == "unary")
115 This just adds lexer support for the unary and binary keywords, like we
163 operators (as you'll see below, it just doesn't apply for unary
175 unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary.
304 the previous framework we built for other operators. Adding unary
308 User-defined Unary Operators
311 Since we don't currently support unary operators in the Kaleidoscope
313 simple support for the 'unary' keyword to the lexer. In addition to
318 /// UnaryExprAST - Expression class for a unary operator.
332 we need to add the parsing logic. Parsing a unary operator is pretty
337 /// unary
339 /// ::= '!' unary
345 // If this is a unary operator, read it.
353 The grammar we add is pretty straightforward here. If we see a unary
355 prefix and parse the remaining piece as another unary operator. This
356 allows us to handle multiple unary operators (e.g. "!!x"). Note that
357 unary operators can't have ambiguous parses like binary operators can,
367 /// ::= ('+' unary)*
371 // Parse the unary expression after the binary operator.
378 /// ::= unary binoprhs
388 With these two simple changes, we are now able to parse unary operators
390 prototypes, to parse the unary operator prototype. We extend the binary
398 /// ::= unary LETTER (id)
402 unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary.
416 return LogErrorP("Expected unary operator");
417 FnName = "unary";
425 As with binary operators, we name unary operators with a name that
428 unary operators. It looks like this:
437 Function *F = getFunction(std::string("unary") + Opcode);
439 return LogErrorV("Unknown unary operator");
476 # Logical unary not.
477 def unary!(v)
483 # Unary negate.
484 def unary-(v)