Skip to content

Instantly share code, notes, and snippets.

Property = obj:Variable
{
PushStack([NSMutableArray array]);
}
- PropSubscr+
{
NSMutableArray *subscripts = PopStack();
$$ = [TQNodeMemberAccess nodeWithReceiver:obj property:[subscript objectAtIndex:0]];
for(int i = 1; i < [subscripts count]; ++i) {
$$ = [TQNodeMemberAccess nodeWithReceiver:$$ property:[subscript objectAtIndex:i]];
Sum = a:Product { PushStack(a); }
( - "+" - b:Product { ReplaceStackTop([TQNodeOperator nodeWithType:kTQOperatorAdd left:StackTop right:b]); }
| - "-" - b:Product { ReplaceStackTop([TQNodeOperator nodeWithType:kTQOperatorSubtract left:StackTop right:b]); }
)* { $$ = PopStack(); }
Product = a:Variable { PushStack(a); }
( - "*" - b:Product { ReplaceStackTop([TQNodeOperator nodeWithType:kTQOperatorMultiply left:StackTop right:b]); }
| - "/" - b:Product { ReplaceStackTop([TQNodeOperator nodeWithType:kTQOperatorDivide left:StackTop right:b]); }
)* { $$ = PopStack(); }
- (llvm::Value *)generateCodeInProgram:(TQProgram *)aProgram block:(TQNodeBlock *)aBlock error:(NSError **)aoErr
{
IRBuilder<> *builder = aBlock.builder;
Module *mod = aProgram.llModule;
// Pose as the parent block for the duration of code generation
self.function = aBlock.function;
self.autoreleasePool = aBlock.autoreleasePool;
Value *testExpr = [_condition generateCodeInProgram:aProgram block:aBlock error:aoErr];
// This file was autogenerated so don't modify it.
// (Compiled with support for up to 32 arguments)
#import <Tranquil/TQDebug.h>
#import <Tranquil/Runtime/TQRuntime.h>
// Passing the sentinel represents that no argument was passed for that slot
#define TQS TQSentinel
extern "C" {
id TQDispatchBlock0(struct TQBlockLiteral *block)
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#import <objc/message.h>
@interface TQStackObject {
Class isa;
}
- (id)copy;
- (id)autoreleasedCopy;
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector;
#Foo {
- init {
super init
print("foo")
^self
}
}
miniFoo = Foo new
print("%@", miniFoo)
//#import <Tranquil/Runtime/TQNumber.h>
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#import <objc/message.h>
@interface TQStackObject {
Class isa;
@protected
id forwarding; // This points to the actual object (initially to itself)
}
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#import <objc/message.h>
// the size needed for the batch, with proper alignment for objects
#define ALIGNMENT 8
#define OBJECTS_PER_BUNCH 64
#define BatchSize ((sizeof(TQBatch) + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1))
#define PoolSize 128
struct _va_list {
unsigned int gp_offset, fp_offset;
void *overflow_arg_area, *reg_save_area;
};
int foo(int bar, ...) {
va_list lst;
va_start(lst, bar);
struct _va_list *list = &lst;
int *first = list->reg_save_area+list->gp_offset;
printf("%d\n", sizeof(int));
NSPointerArray *TQVaargsToArray(va_list *items)
{
register id arg;
NSPointerArray *arr = [NSPointerArray pointerArrayWithWeakObjects];
while((arg = va_arg(*items, id)) != TQSentinel) {
[arr addPointer:arg];
}
return arr;
}