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,6 @@
String original = 'Test';
String cloned = original;
//"original == cloned" is true
cloned += ' more';
//"original == cloned" is false

View file

@ -0,0 +1,10 @@
Lbl STRCPY
r₁→S
While {r₂}
{r₂}→{r₁}
r₁++
r₂++
End
0→{r₁}
S
Return

View file

@ -0,0 +1,28 @@
ldsrc: LDA src
stdest: STA dest
BRZ done ; 0-terminated
LDA ldsrc
ADD one
STA ldsrc
LDA stdest
ADD one
STA stdest
JMP ldsrc
done: STP
one: 1
src: 82 ; ASCII
111
115
101
116
116
97
0
dest:

View file

@ -0,0 +1,6 @@
(define-syntax-rule (string-copy s) (string-append s)) ;; copy = append nothing
→ #syntax:string-copy
(define s "abc")
(define t (string-copy s))
t → "abc"
(eq? s t) → #t ;; same reference, same object

View file

@ -0,0 +1,12 @@
' FB 1.05.0 Win64
Dim s As String = "This is a string"
Dim t As String = s
' a separate copy of the string contents has been made as can be seen from the addresses
Print s, StrPtr(s)
Print t, StrPtr(t)
' to refer to the same string a pointer needs to be used
Dim u As String Ptr = @s
Print
Print *u, StrPtr(*u)
Sleep

View file

@ -0,0 +1,6 @@
include "ConsoleWindow"
dim as Str15 s, c
s = "Hello!"
c = s
print c

View file

@ -0,0 +1,6 @@
//Text is mutable.
software {
var s = "Hello"
var c = copy(s)
print(c)
}

View file

@ -0,0 +1,22 @@
.ORIG 0x3000
LEA R1,SRC
LEA R2,COPY
LOOP LDR R3,R1,0
STR R3,R2,0
BRZ DONE
ADD R1,R1,1
ADD R2,R2,1
BRNZP LOOP
DONE LEA R0,COPY
PUTS
HALT
SRC .STRINGZ "What, has this thing appeared again tonight?"
COPY .BLKW 128
.END

View file

@ -0,0 +1,3 @@
(let* ((a '"data assigned to a")
(b a))
(: io format '"Contents of 'b': ~s~n" (list b)))

View file

@ -0,0 +1,8 @@
> (set a '"data")
"data"
> a
"data"
> (set b a)
"data"
> b
"data"

View file

@ -0,0 +1,18 @@
local(x = 'I saw a rhino!')
local(y = #x)
#x //I saw a rhino!
'\r'
#y //I saw a rhino!
'\r\r'
#x = 'I saw one too'
#x //I saw one too
'\r'
#y //I saw a rhino!
'\r\r'
#y = 'it was grey.'
#x //I saw one too
'\r'
#y //it was grey.

View file

@ -0,0 +1,2 @@
str = "Hello world!"
str2 = str

View file

@ -0,0 +1,5 @@
put "X" before str
put "X" after str
put "X" into char 6 of str
put str
-- "XHellX world!X"

View file

@ -0,0 +1,3 @@
put "foo" into bar
put bar into baz
answer bar && baz

View file

@ -0,0 +1,3 @@
var
c = "This is a string"
d = c # Copy of content into new string

View file

@ -0,0 +1 @@
"abcde" dup

View file

@ -0,0 +1 @@
StringBuffer new "abcde" <<

View file

@ -0,0 +1,5 @@
string this = "feed"
string that = this -- (that becomes "feed", this remains "feed")
that[2..3] = "oo" -- (that becomes "food", this remains "feed")
this[1] = 'n' -- (that remains "food", this becomes "need")
?{this,that}

View file

@ -0,0 +1,2 @@
cStr1 = "Hello!" # create original string
cStr2 = cStr1 # make new string from original

View file

@ -0,0 +1,4 @@
var original = "hello"; # new String object
var reference = original; # points at the original object
var copy1 = String.new(original); # creates a new String object
var copy2 = original+''; # ==//==

View file

@ -0,0 +1,2 @@
var src = "Hello"
var dst = src

View file

@ -0,0 +1,3 @@
decl string a b
set a "hello"
set b a

View file

@ -0,0 +1,8 @@
def demo:
"abc" as $s # assignment of a string to a variable
| $s as $t # $t points to the same string as $s
| "def" as $s # This $s shadows the previous $s
| $t # $t still points to "abc"
;
demo