-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made compact formatting the default for everything
- Loading branch information
1 parent
8b1efa8
commit 5a7e9ee
Showing
31 changed files
with
220 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
// This script uses array.nolol to store some values and retrieve themm again | ||
|
||
define data = :d | ||
define addr = :a | ||
define write = :m | ||
define data=:d | ||
define addr=:a | ||
define write=:m | ||
|
||
// store value at idx in array | ||
macro set(idx, value) | ||
write = 1 | ||
data = value | ||
addr = idx | ||
write=1 | ||
data=value | ||
addr=idx | ||
// this will block until addr is 0. | ||
// the array will set addr to 0 once it stored the value | ||
wait addr | ||
end | ||
|
||
// retrieve value from idx | ||
macro get(idx, value) | ||
write = 0 | ||
addr = idx | ||
write=0 | ||
addr=idx | ||
// this will block until addr is 0. | ||
// the array will set addr to 0 once it retrieved the value | ||
wait addr | ||
value = data | ||
value=data | ||
end | ||
|
||
while ++i < 5 do | ||
insert set(i, i * 2) | ||
while ++i<5 do | ||
insert set(i,i*2) | ||
end | ||
|
||
:sum = "" | ||
while ++j < 5 do | ||
insert get(j, retrieved) | ||
:sum += retrieved + "," | ||
:sum="" | ||
while ++j<5 do | ||
insert get(j,retrieved) | ||
:sum+=retrieved+"," | ||
end | ||
|
||
:done = 1 | ||
:done=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
// this program checks if the language is really case-insensitive | ||
// despit the really excentric naming (of even the keywords) all global variables should have the value 1 at the end | ||
Var = 123; var = 456 | ||
:assignok = Var == 456 | ||
Var=123;var=456 | ||
:assignok=Var==456 | ||
|
||
FoO = "test" | ||
:derefok = Foo == FoO | ||
FoO="test" | ||
:derefok=Foo==FoO | ||
|
||
:funcOK = sin(3) == SIN(3) | ||
:funcOK=sin(3)==SIN(3) | ||
|
||
if foo == FOO then | ||
:ifok = 1 | ||
if foo==FOO then | ||
:ifok=1 | ||
end | ||
|
||
define TEST = "FOO" | ||
:defineOK = test == "FOO" | ||
define TEST="FOO" | ||
:defineOK=test=="FOO" | ||
|
||
NUM = 1 | ||
while num++ < 4 do | ||
:loopok = num == NUM | ||
NUM=1 | ||
while num++ <4 do | ||
:loopok=num==NUM | ||
end | ||
|
||
macro fooBar(bar) | ||
:macroOK = bar == BAR and bar == "FOO" | ||
:macroOK=bar==BAR and bar=="FOO" | ||
end | ||
|
||
insert FOOBAR(TEST) | ||
|
||
:done = 1 | ||
:done=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
// define greeting to be hello | ||
define greeting = "Hello" | ||
define greeting="Hello" | ||
|
||
:name = "Peter" | ||
:name="Peter" | ||
|
||
// definitions can be any expression you like and even contain other definitions, variables or functions | ||
define message = greeting + " " + "world and " + :name | ||
define message=greeting+" "+"world and "+:name | ||
|
||
// you can define a new name for a variable | ||
// if the defined value is a variable name (and nothing else), you can assign to it | ||
// this is practically aliasing :out to :output | ||
define :output = :out | ||
define :output=:out | ||
|
||
// :output is replaced by ":out" and message is replaced by the expression declared in it's definition | ||
:output = message | ||
:output=message | ||
|
||
|
||
// your definitions can contain polaceholders (here a and b) | ||
define addByte(a, b) = (a + b) % 2 ^ 8 | ||
define addByte(a, b)=(a+b)%2^8 | ||
|
||
a = 123 | ||
a=123 | ||
// definitions with placeholders can be used like functions. The aruments will replace the placeholders of the definition | ||
:sum = addByte(a, 100) | ||
:sum=addByte(a,100) | ||
|
||
define foo(a, b, c, d) = a + b + c + d | ||
define foo(a, b, c, d)=a+b+c+d | ||
|
||
// Any valid expression can be used as value for a placeholder | ||
:bar = foo(greeting, ",", " " + :name, addByte(a, 60)) | ||
:bar=foo(greeting,","," "+:name,addByte(a,60)) | ||
|
||
define pop(string) = string - --string | ||
define pop(string)=string- --string | ||
|
||
:done = 1 | ||
:done=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
:timeok = time() | ||
:absok = abs( -5) == ABS(5) | ||
if abs( -2) == abs(2) then | ||
:absinifok = 1 | ||
:timeok=time() | ||
:absok=abs(-5)==ABS(5) | ||
if abs(-2)==abs(2) then | ||
:absinifok=1 | ||
end | ||
:sqrtok = SQRT(16) == 4 | ||
:sqrtok=SQRT(16)==4 | ||
|
||
:done = 1 | ||
:done=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
// this example shows the use of labeled gotos | ||
// but be cautious when using goto. It is bad style, error prone and hinders optimization | ||
:out = "a" | ||
:out="a" | ||
goto b | ||
// labels can be on the same line as a statement | ||
c> :out += "c" | ||
c> :out+="c" | ||
goto d | ||
b> :out += "b" | ||
b> :out+="b" | ||
goto c | ||
d> // or on an own line. code automatically falls through empty lines | ||
|
||
|
||
:out += "d"; goto e | ||
:out+="d";goto e | ||
|
||
if 1 == 0 then | ||
if 1==0 then | ||
// you can even jump into ifs | ||
e> :out += "e" | ||
e> :out+="e" | ||
// and out again | ||
goto f | ||
end | ||
|
||
f> :out += "f"; goto eof | ||
f> :out+="f";goto eof | ||
|
||
:out = "skip this" | ||
:out="skip this" | ||
eof> | ||
|
||
:done = 1 | ||
:done=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
define stop = 10 | ||
define stop=10 | ||
|
||
while i++ < stop do | ||
:hello += "." | ||
while i++ <stop do | ||
:hello+="." | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
define name = "daniel" | ||
:hello = "hello " | ||
define name="daniel" | ||
:hello="hello " | ||
// other nolol files can be included into nolol files | ||
// the content of the included file will be pasted right where the include instruction was placed in the code | ||
// this happens during compilation. Therefore the included path can not be dynamically created | ||
include "included.nolol" | ||
:hello += " " + name | ||
:hello+=" "+name | ||
|
||
:done = 1 | ||
:done=1 |
Oops, something went wrong.