Valid HTML 4.01!

Valid CSS!
www.oisyn.nl news whois projects forum new user

questa at 1-03-07 15:23
AAADDDS! * click

Woudloper at 24-01-07 11:58
Zag de ads! Heb er nog op één geklikt omdat er iets interessants tussenstond :)

.oisyn at 23-01-07 15:46
Aangezien ik zowaar visitors heb, even wat ads toegevoegd :+

Woudloper at 8-01-07 8:02
Met de UBB Parser aan het stoeien

Woudloper at 5-01-07 10:22
Nieuwe reactie toegevoegd bij het artikel over UBB Parser

Spockz at 31-12-06 12:42
Ja, dit werkt nog hoor. :)

.oisyn at 28-12-06 16:37
Werkt dit nog?

questa at 21-11-05 15:15
*gaap

Grubolsch at 9-06-05 17:12
Bedankt om dit alles open source te maken, ik vermeld je zeker op mijn website! Echt knap werk!

Grubolsch at 9-06-05 17:12
.oisyn, ik moet zeggen dat ik je parser enorm knap vind, en ook je syntacs highlighter!

questa at 8-02-05 13:52
Jammer dat het nooit af komt, maar vertel is meer over je nieuwe baan!!!

.oisyn at 17-05-04 15:28
Dat laatste, weinig tijd enzo. Eerlijk gezegd denk ik niet dat het ooit nog geimplementeerd wordt :/

koli-man at 11-05-04 22:38
Is er eigenlijk nog Orbb nieuws of staat project een beetje stil?

.oisyn at 2-04-04 18:38
/me doet maar weer eens een update :P

eamelink at 1-02-04 11:27
*kick* ;)

questa at 8-12-03 22:16
Kom op, pronken met die zooi!!!

curry684 at 4-12-03 14:04
En waar is de sourcecode van Orbb? Doe eens treehugging opensource hippie uithangen!

questa at 1-12-03 12:49
Damz.. dan maar even hopen dat de compiler snel aan ze 1.0 versie komt :) dan is Questa weer blij!

coubertin119 at 12-11-03 18:32
Pff, ik ben gewoon ongeduldig ;)

.oisyn at 12-11-03 18:29
Wat boeit dat? Je hebt er toch niets aan zolang er geen compiler is ;)

Active articles#

Kol Q l8or 2 beta 4
Code syntax highlighter (php module) 21
UBB Parser (PHP code) 9
Compile-time sqrt in C++ 3
Experiment #1 2
More dynamics :) 3
Interfacing Orbb with C++ 1
Site migrated 0
Integer division using binary long division method 0
Nieuwe forum online 0
Not logged in

Projects / Kol Q l8or / Kol Q l8or 2 beta


Kol Q l8or 2 beta
Mon 18 Jan 2010 17:16 by .oisyn

What's this? After 4 years another post? Anyway, here's a beta version of Kol Q l8or 2, a calculator application that works by parsing expressions rather than hitting buttons on a physical calculator like Windows' calc.exe.

Some of you might know and maybe use my old Kol Q l8or

The old Kol Q l8or version 1

Here's the new and improved version 2!


Changes since version 1:


Unfortunately, I have not yet implemented to output in bases other than 10. Also, as functions can now accept multiple parameters, parantheses are now mandatory. So for example, you'll have to key in 'cos(3)' rather than 'cos 3'.

Other than the functions and variables available in Kol Q l8or 1, it additionally supports these functions and commands:
apply function
Syntax: apply(var:start..stop,result:init,expression)
Example: apply(i:1..10,r:0,r+i)
Evaluates 'expression' for each 'var' between 'start' and 'stop' (inclusive), and stores the result in 'result' on each iteration. 'result' is initialized with 'init'. The above example calculates 0+1+2+3+...+10

if function
Syntax: if(expression, truepart, falsepart)
Example: if(x>0, x + 4, -x)
If 'expression' is nonzero, it returns 'truepart', else 'falsepart'

/for command
Syntax: /for var:start..stop [step x], expression
Example: for i:0..10, i**2
Evaluates 'expression' for each 'var' between 'start' and 'stop' (with optional step 'x'), and outputs the result for each iteration

/d command
Syntax: /d
Displays a list of userdefined functions and variables

/clear command
Syntax: /clear
clears the output window

/quit command
Syntax: /quit
Shuts down the application

4 comments - 1 page
Post comment


Comments


Thu 30 Jun 2011 17:15 by .oisyn

New version is released! http://oisyn.nl/apps/Kol%20Q%20l8or%202.exe

Most notable changes are output in (multiple) bases other than 10, referencable result buffer, and in-app documentation .
Here's a copy/paste of the docs:

Code:

1
2
#include <aap>
std::cout << "Hi there" << std::endl;

Thu 30 Jun 2011 17:16 by .oisyn

Lol ok apparently my code highlighter is malfunctioning

Quote:
*** Help on syntax ***

There are two types of input: expressions and commands. Commands always start with a forward slash, '/'. To get help on various commands, type '? commands'.

** Expressions **
Expressions are simple mathematical formulas of what you want to calculate. These expressions are made up out of numbers, variables, functions and operators. Some examples:
1+1
3*(5-2.3)
cos(pi)/sin(pi)

** Numbers **
Numbers consist of digits, an optional decimal point '.', and an optional exponent. Additionally, bases other than 10 are also supported using a base prefix. These prefixes are:
0b... - binary (base 2)
0o... - octal (base
0d... - decimal (base 10)
0x... - hexadecimal (base 16)
\b\... - base 'b', where 2 <= b <= 36
The decimal point and exponent are supported even for bases other than 10. Bases higher than 10 use 'a' through 'z' for digits, where 'a' represents 10 and z represents 36. Alphabetical digits are not case sensitive. Exponents are also in their respective base.
Examples:
0b11011011 = 219
0x34fc.4 = 13564.25
0x1.8_e2 = 1.5 * 16**2 = 384
\24\3fg5 = 50501
Note that for the 0x and \b\ prefixes, an underscore before the 'e' of the exponent is mandatory, to distinguish the exponent from the digit 'e'. See the /setbase command (enter '? /setbase') for information on altering the default output base.

** Identifiers **
Variables, constants and functions are referenced by an identifier. Identifiers always start with a letter, and are followed by zero or more letters and/or digits. Rather than the digits in numbers, the letters in variables are case sensitive. To (re)assign a variable or funtion, use the := operator:
x := 3 + 45
f(a) := 2*a
g(b) := f(b/2)+x
foo(a,b) := a/b
As you can see, functions with more than one argument are supported as well. Note that, on assignment, any other variable or function referenced in the definition is copied as is. Therefore, in above example, reassigning the function f() after assigning g() does not change the meaning of g(). This also means that recursive functions are not supported - using f() in the definition of f() either uses the previous definition of f(), or generates an error that f is undefined.

Any whitespace (tabs or spaces) between operators, numbers and identifiers in expressions is ignored. Therefore, 'foo ( a, b) := a / b' has exactly the same meaning als 'foo(a,b):=a/b'. For an exhaustive list of operators, built-in functions and built-in constants, type '? operators', '? functions' and '? constants', respectively.

** #-Syntax **
Whenever you enter an expression, you'll notice that the result is prefixed by a '#' and a number in square brackets. Each result is stored in a buffer, and you can use this number to reference it later on, using '#' immediately followed by a number (no whitespace is allowed between '#' and the number). To simply refer to the last result, type '#' without a number. Alternatively, you can use the ans() function. Enter '? ans' for more details on this subject.
----
/clear
Clears the output window.

/d
Shows a list of definitions.

/for i:from..to [step x], expression
Iterates the variable 'i' from 'from' to 'to' (with an optional step size 'x'), evaluating 'expression' each iteration, the result printed to the screen and stored in the result buffer.
Examples:
/for x:2..4*5, 8*x
/for i:0..1 step 0.1, sqrt(i)

/quit
Exits the application.

/results
Shows a list of all the results stored in the result buffer.

/setbase b1 [, b2 [, b3 ... ] ]
Sets one or more output bases. Acceptable bases range from 2 to 36.
----

*** Help on Operators ***

Kol Q l8or fully supports most the arithmetic operators of C-like programming languages, and some more. Note that, as this tool is mainly targeted at programmers, ^ is the bitwise XOR operator and not the power operator. For power, use **.
(): Grouping parentheses
+: Addition (binary) or positive (unary)
-: Subtraction (binary) or negation (unary)
*: Multiplication
/: Division
%: Modulo (remainder)
**: Power
&, &&: Bitwise and logical AND
|, ||: Bitwise and logical OR
^, ^^: Bitwise and logical XOR
~, !: Bitwise and logical NOT
<<, >>: Bitwise shift left and right
>>>: Arithmetic shift right (extends the sign-bit)
=, ==: Equality
!=, <>: Nonequality
<, <=, >, >=: Order

** A note on logical operators **
While Kol Q l8or does not support boolean types, it interprets 0 as false and any other value as true, like many C-like languages. The result of a logical expression however, will always be 0 (false) or 1 (true)
|| and && support short-circuiting. That is, the right-hand side of the operator is not evaluated unless the left-hand side is false in case of || or true in case of &&. This is particularly useful for expensive computations.

** Operator precedence and associativity **
The precedence and associativity are also similar to languages such as C and C++. The operators here are listed from most precedent to least precedent.

(...)
unary +, unary -, ~, !
**
*, /, %
binary +, binary -
<<, >>, >>>
<, <=, >, >=
=, ==, !=, <>
&
^
|
&&
^^
||

All operators are left-associative, with the exception of **.
----
abs(x)
Calculates the absolute value of x

acos(x)
Calculates the inverse cosine of x

ans(x)
Yields the result of the x'th calculation (#x), or 0 if it doesn't exist. If x<0, it counts backwards (so ans(-1) returns the last calculation). ans(0) returns the number of results currently stored in the result buffer.
The main difference between #x and ans(x) is that #x is evaluated immediately, while ans(x) is evaluated every time it is encountered. This makes ans(x) with negative x particularly useful in /for loops, to refer to results of earlier iterations.

apply(i:from..to, r:init, expression [, stopcondition])
Initializes the variable 'r' with 'init', then iterates the variable 'i' from 'from' to 'to', evaluating 'expression' each time and assigns the result to 'r'. After all iterations, or as soon as the optional 'stopcondition' evaluates to true, it returns the final variable 'r'.
Examples:
apply(x:1..10, r:0, r+x) => 1+2+3+...+10
apply(i:1..#0, c:0, c+ans(i)) => the sum of all results in the result buffer
apply(i:1..Infinity, r:1, r*2, r>1000) => the first power of two after 1000

asin(x)
Calculates the inverse sine of x

atan(x)
Calculates the inverse tangent of x

ceil(x)
Rounds x up towards the nearest integer

cos(x)
Calculates the cosine of x

cosh(x)
Calculates the hyperbolic cosine of x

exp(x)
Raises e to the x'th power, or e**x

fact(x)
Calculates the factorial of x

float(x)
Discards everthing before the decimal point (equivalent to frac(x))

floor(x)
Rounds x down towards the nearest integer

frac(x)
Discards everthing before the decimal point (equivalent to float(x))

if(condition,truepart,falsepart)
Evaluates 'condition'. If true, it evaluates and returns 'truepart'. Otherwise, it evaluates and returns 'falsepart'.

int(x)
Truncates x (discards everything after the decimal point)

ln(x)
Calculates the natural (base-e) logarithm of x (equivalent to ln(x))

log(x)
Calculates the base-10 logarithm of x (equivalent to log10(x))

log10(x)
Calculates the base-10 logarithm of x (equivalent to log(x))

loge(x)
Calculates the natural (base-e) logarithm of x (equivalent to loge(x))

sin(x)
Calculates the sine of x

sinh(x)
Calculates the hyperbolic sine of x

sqrt(x)
Calculates the square root of x

tan(x)
Calculates the tangent of x

tanh(x)
Calculates the hyperbolic tangent of x
----
Infinity
A constant for infinity.

NaN
Not a number.

e
The base of the natural logarithm.

pi
The ratio of a circle's circumference to its diameter.
----

*** Tips and Tricks ***
apply(), ans() and /for can be very powerful tools for more complicated calculations. Here are some examples.

Calculate the sum of result x through y
sumresults(x,y) := apply(i:x..y, r:0, r+ans(i))

Verify whether a number is prime (warning, can be slow for large primes)
isprime(n) := n >= 2 && (n <= 3 || (n % 2 != 0 && apply(i:1..sqrt(n)/2, r:1, n % (i*2+1) != 0, !r)))

Generate Fibonacci numbers
1
1
/for i:0..20, ans(-1) + ans(-2)
(repeat the /for loop immediately after for even more numbers)
----
Tue 20 Dec 2011 1:36 by .oisyn

New version!
And (rudimentary) dedicated landing page: http://oisyn.nl/kolql8or/

Features:
vectors, recursive functions (late binding), and more.

This also means it now is Turing complete! yay
Tue 20 Dec 2011 1:37 by .oisyn

http://oisyn.nl/kolql8or/


Post comment


You must be logged in to post a comment