libt/tSIntegerW.tea
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sun, 27 Sep 2015 07:07:46 +0100
changeset 19 7597503194b8
permissions -rw-r--r--
First shot of libt and some examples libt serves (well, might serve at some point) as a basic library for Tea language. Added directory with examples demostration Tea (and libt) Both includes makefiles to compile libt and examples to compile them down to machine code. This also demonstrates how to use `teak`, a standalone Tea compiler.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
nil subclass: #tSIntegerW
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
    category: 't-Kernel'
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
!
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
!tSIntegerW methodsFor: 'comparing'!
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
< another <tSIntegerW> <^tBoolean>
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
    <primitive: [:asm |
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
    	asm ret: (asm icmp: self _: another cond: LLVMIntSLT)
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
    ]>
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
!
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
> another <tSIntegerW> <^tBoolean>
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
    <primitive: [:asm |
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
    	asm ret: (asm icmp: self _: another cond: LLVMIntSGT)
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
    ]>
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
!
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
= another <tSIntegerW> <^tBoolean>
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
    <primitive: [:asm |
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
    	asm ret: (asm icmp: self _: another cond: LLVMIntEQ)
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
    ]>
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
! !
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
!tSIntegerW methodsFor: 'arithmetic'!
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
+ another <tSIntegerW> <^tSIntegerW>
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
    <primitive: [:asm |
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
    	asm ret: (asm add: self _: another)
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
    ]>
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
!
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
- another <tSIntegerW> <^tSIntegerW>
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
    <primitive: [:asm |
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
    	asm ret: (asm sub: self _: another)
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
    ]>    
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
!
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
* another <tSIntegerW> <^tSIntegerW>
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
    <primitive: [:asm |
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
    	asm ret: (asm mul: self _: another)
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
    ]>        
7597503194b8 First shot of libt and some examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
! !