Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,7 @@
if (s == 'Hello World') {
foo();
} else if (s == 'Bye World') {
bar();
} else {
deusEx();
}

View file

@ -0,0 +1,3 @@
if(obj != null && obj.foo()){
aMethod();
}

View file

@ -0,0 +1,3 @@
if(obj != null & obj.foo()){
aMethod();
}

View file

@ -0,0 +1 @@
s == 'Hello World' ? foo() : bar();

View file

@ -0,0 +1,3 @@
If 1
YEP()
End

View file

@ -0,0 +1,3 @@
!If 1
NOPE()
End

View file

@ -0,0 +1,5 @@
If 1
YEP()
Else
NOPE()
End

View file

@ -0,0 +1,7 @@
If 1=0
NOPE()
ElseIf 1=1
YEP()
Else
NOPE()
End

View file

@ -0,0 +1,7 @@
If 1=0
NOPE()
Else!If 1=2
YEP()
Else
NOPE()
End

View file

@ -0,0 +1 @@
IF condition THEN PRINT "True"

View file

@ -0,0 +1,5 @@
IF condition THEN
PRINT "True"
ELSE
PRINT "False"
ENDIF

View file

@ -0,0 +1,6 @@
IF choice=1 THEN
PRINT "One"
ELIF choice=2 THEN
PRINT "Two"
ELSE
Print "None of the above"

View file

@ -0,0 +1,8 @@
CASE choice OF
WHEN 1
PRINT "One"
WHEN 2
PRINT "Two"
OTHERWISE
PRINT "Some other choice"
ENDCASE

View file

@ -0,0 +1,8 @@
Dim a As Integer = 1
If a = 1 Then
sub1
ElseIf a = 2 Then
sub2
Else
sub3
End If

View file

@ -0,0 +1,9 @@
Dim a As Integer = 1
Select Case a
Case 1
sub1
Case 2
sub2
Case Else
sub3
End Select

View file

@ -0,0 +1,2 @@
Dim b As Boolean = True
Dim i As Integer = IIf(b, 1, 2)

View file

@ -0,0 +1,2 @@
Dim a As Integer = 1
On a Goto label1, label2

View file

@ -0,0 +1,2 @@
Dim b As Boolean = True
If b Goto label

View file

@ -0,0 +1,2 @@
Dim a As Integer = 1
On a Gosub label1, label2

View file

@ -0,0 +1,8 @@
#DEFINE WORDSIZE 16
#IF (WORDSIZE = 16)
' Do some some 16 bit stuff
#ELSEIF (WORDSIZE = 32)
' Do some some 32 bit stuff
#ELSE
#ERROR WORDSIZE must be set to 16 or 32
#ENDIF

View file

@ -0,0 +1,4 @@
#DEFINE _DEBUG
#IFDEF _DEBUG
' Special statements for debugging
#ENDIF

View file

@ -0,0 +1,3 @@
#IFNDEF _DEBUG
#DEFINE _DEBUG
#ENDIF

View file

@ -0,0 +1 @@
if <condition> then <truebranch> else <falsebranch>

View file

@ -0,0 +1,5 @@
IF X THEN
// do if X is not 0
ELSE
// do if X is 0
END;

View file

@ -0,0 +1,13 @@
CASE
IF X == 1 THEN
// do stuff if X equals 1
END
IF X == 2 THEN
// do stuff if X equals 1
END
IF X == 3 THEN
// do stuff if X equals 3
END
DEFAULT
// do other stuff
END;

View file

@ -0,0 +1,7 @@
IF x == 1
SomeFunc1()
ELSEIF x == 2
SomeFunc2()
ELSE
SomeFunc()
ENDIF

View file

@ -0,0 +1,8 @@
DO CASE
CASE x == 1
SomeFunc1()
CASE x == 2
SomeFunc2()
OTHERWISE
SomeFunc()
ENDCASE

View file

@ -0,0 +1,10 @@
SWITCH x
CASE 1
SomeFunc1()
EXIT
CASE 2
SomeFunc2()
EXIT
OTHERWISE
SomeFunc()
ENDSWITCH

View file

@ -0,0 +1,20 @@
software {
var a = 3
//This is not guaranteed to be quicker than a if-else chain.
switch a {
case 3
print("3=3")
case 2
print("WHAT?")
default
print("3!=2")
}
if a != 2
print("3!=2")
print("verified")
else
print("3=2!!!")
end
}

View file

@ -0,0 +1,10 @@
BR or BRnzp ; unconditional branch, i.e.
; branch if (result < 0 || result == 0 || result > 0)
; ^ this is always true
BRn ; branch if (result < 0)
BRz ; branch if (result == 0)
BRp ; branch if (result > 0)
; or any combination of these condition codes, e.g.
BRnz ; branch if (result <= 0)

View file

@ -0,0 +1,19 @@
.orig x3000
LD R1, x ; get x
LD R2, y ; get y
NOT R0, R2 ; R0 = ~y
ADD R0, R0, 1 ; R0 = -y
ADD R0, R0, R1 ; R0 = x - y
BRZ BRANCH ; if (x == y) { go to BRANCH }
LEA R0, nottaken
PUTS ; else print "Branch Not Taken!"
BR END
BRANCH
LEA R0, taken
PUTS ; print "Branch Taken!"
END HALT
x .fill 1
y .fill 1
taken .stringz "Branch Taken!"
nottaken .stringz "Branch Not Taken!"
.end

View file

@ -0,0 +1,8 @@
che cosè var? # switch var
minore di 0: # case var < 0
...
maggiore di 0: # case var > 0
...
o tarapia tapioco: # else (none of the previous cases)
...
e velocità di esecuzione

View file

@ -0,0 +1,10 @@
if(s == "Hello World")
{
foo();
}
else if(s == "Bye World")
bar();
else
{
baz();
}

View file

@ -0,0 +1,2 @@
if(obj isnt null and obj.foo())
doSomething();

View file

@ -0,0 +1 @@
var t = if(s == "Hello World") foo() else bar();

View file

@ -0,0 +1,11 @@
switch (num)
{
case (0)
{ /* empty case requires braces */ }
case (1)
{ var one = "one"; result = one; }
case (2,3) // case may contain a nonempty list of values
result = "a few";
default
result = "a lot";
}

View file

@ -0,0 +1,8 @@
if x == 0:
foo()
elif x == 1:
bar()
elif x == 2:
baz()
else:
boz()

View file

@ -0,0 +1,9 @@
case x
of 0:
foo()
of 2,5,9:
baz()
of 10..20, 40..50:
baz()
else: # All cases must be covered
boz()

View file

@ -0,0 +1,5 @@
aBoolean ifTrue: [ ...]
aBoolean ifFalse: [ ... ]
aObject ifNull: [ ... ]
aObject ifNotNull: [ ... ]
aObject ifZero: [ ... ]

View file

@ -0,0 +1 @@
else: [ ... ]

View file

@ -0,0 +1,4 @@
Number virtual: sgn
self isPositive
ifTrue: [ self ==0 ifTrue: [ 0 ] else: [ 1 ] ]
else: [ -1 ] ;

View file

@ -0,0 +1,8 @@
var a = 5;
if (a == 5) {
doSomething();
} else if (a > 0) {
doSomethingElse();
} else {
error();
}

View file

@ -0,0 +1,7 @@
If x == 1
SomeFunc1()
But x == 2
SomeFunc2()
Else
SomeFunc()
Ok

View file

@ -0,0 +1,8 @@
Switch x
On 1
SomeFunc1()
On 2
SomeFunc2()
Other
SomeFunc()
Off

View file

@ -0,0 +1,3 @@
01010000000000100000000000000000 -10 to c
00000000000000110000000000000000 Test
01110000000000000000000000000000 14 to CI

View file

@ -0,0 +1 @@
if cond then f else g end

View file

@ -0,0 +1 @@
if cond then f elif cond1 then f1 .... else g end

View file

@ -0,0 +1,4 @@
if empty then 2 else 3 end # produces no value
if 1 then 2 else 3 end # produces 2
if [false, false] then 2 else 3 end # produces 2
if (true, true) then 2 else 3 end # produces a stream: 2, 2

View file

@ -0,0 +1,7 @@
exp
| if . == true then "true"
elif . == false then "false"
elif . == null then "maybe"
elif type == "string" then .
else error("unexpected value: \(.)")
end