From: Michael Andreen Date: Tue, 7 Feb 2006 10:18:09 +0000 (+0000) Subject: moved comments to examples X-Git-Url: https://ruin.nu/git/?p=proglang.git;a=commitdiff_plain;h=5f2040d19e69f864edcc7f2e2d27ea9bd298d26a moved comments to examples --- diff --git a/documentation b/documentation index cb693df..cf26d0a 100644 --- a/documentation +++ b/documentation @@ -1,8 +1,6 @@ ####### DOCUMENTATIATOIAITAT ION ######## - - a simple c-like language with support for if/else-statements, while-loops and the standard arithmetic (+, -, /, *) and comparison expressions (<, >, <=, >=, ==, !=). also, increase/decrease expressions (++, --) are supported. data types: @@ -11,67 +9,3 @@ integers and booleans. comments: // and /* */ comments are allowed. - - - - - - - - - - - - -examples: - -fib ---- -int n1 = 0; -int n2 = 1; -int n = readInt; - -while(n-- > 0){ - int temp = n1+n2; - n1 = n2; - n2 = temp; -} -print n2; - - -tests while, decr and assignment. - - - -if --- -if (readBool) { - if (readInt < 0) - print true; - else - print false; -} - - -tests if and if/else. - - - -sum ---- -int n; -int sum = 0; -while ((n = readInt) != -1) sum = sum + n; -print sum; - - - - -var ---- -int a = 3; -int b = a - 5; -int c = a + b*7; -bool d = a == b; - -tests simple variable operations. \ No newline at end of file diff --git a/examples/fib b/examples/fib index 0cf71f3..3bad4e9 100644 --- a/examples/fib +++ b/examples/fib @@ -1,3 +1,6 @@ +/* +tests while, decr and assignment. +*/ int n1 = 0; int n2 = 1; int n = readInt; diff --git a/examples/if b/examples/if index c002570..4f6040e 100644 --- a/examples/if +++ b/examples/if @@ -1,6 +1,9 @@ +/* +tests if and if/else +*/ if (readBool) { if (readInt < 0) print true; else print false; -} \ No newline at end of file +} diff --git a/examples/sum b/examples/sum index cda8206..d39cfe6 100644 --- a/examples/sum +++ b/examples/sum @@ -1,3 +1,6 @@ +/* +Tests assignment as expression +*/ int n; int sum = 0; diff --git a/examples/var b/examples/var index 51c5584..17ce262 100644 --- a/examples/var +++ b/examples/var @@ -1,3 +1,6 @@ +/* +Tests simple variable assignments and expressions. +*/ int a = 3; int b = a - 5; int c = a + b*7;