too many changes to list

This commit is contained in:
Andreas Rumpf 2008-08-23 11:16:44 +02:00
commit 07d5a8085b
200 changed files with 24344 additions and 17809 deletions

View file

@ -11,9 +11,28 @@ proc fac[T](x: T): T =
if x <= 1: return 1
else: return x * fac(x-1)
macro macrotest(n: expr): stmt =
expectKind(n, nnkCall)
expectMinLen(n, 2)
result = newNimNode(nnkStmtList, n)
for i in 2..n.len-1:
result.add(newCall("write", n[1], n[i]))
result.add(newCall("writeln", n[1], newStrLitNode("")))
macro debug(n: expr): stmt =
result = newNimNode(nnkStmtList, n)
for i in 1..n.len-1:
result.add(newCall("write", newIdentNode("stdout"), toStrLit(n[i])))
result.add(newCall("write", newIdentNode("stdout"), newStrLitNode(": ")))
result.add(newCall("writeln", newIdentNode("stdout"), n[i]))
macrotest(stdout, "finally", 4, 5, "variable", "argument lists")
macrotest(stdout)
#GC_disable()
echo("This was compiled by Nimrod version " & system.nimrodVersion)
writeln(stdout, "Hallo", " World", "!")
echo(["a", "b", "c", "d"].len)
for x in items(["What's", "your", "name", "?"]):
@ -21,6 +40,13 @@ for x in items(["What's", "your", "name", "?"]):
var `name` = readLine(stdin)
{.breakpoint.}
echo("Hi " & thallo.name & "!\n")
debug(name)
var testseq: seq[string] = [ "a", "b", "c", "d"]
echo(repr(testseq))
var dummy = "hallo"
echo(copy(dummy, 2, 3))
for i in 2..6:
for j in countdown(i+4, 2):