Showing posts with label jfuzuli. Show all posts
Showing posts with label jfuzuli. Show all posts

Sunday, March 22, 2015

Introduction to Fuzuli : JFuzuli REPL


JFuzuli is the JVM implementation of our programming language Fuzuli which is based on LISP syntax and Algol family programming logic. Fuzuli is a modern collaboration of these two separate family of languages.

Let's try JFuzuli:




1. Download the Jar 

The current compiled jar of JFuzuli interpreter is release candidate 1.0. You can download it using the link https://github.com/jbytecode/fuzuli/releases/tag/v1.0_release_candidate. You can always find the newest releases in site JFuzuli Releases.

2. Open the Command Prompt

After downloading the jar file, open your operation system's command prompt and locate the jar file by using cd (change directory) command.

3. Start trying it!

In command prompt, type

java -jar JFuzuli.jar

to start. You will see the options:

Usage:
java -jar JFuzuli.jar fzlfile
java -jar JFuzuli.jar --repl
java -jar JFuzuli.jar --editor


You can specify a fuzuli source file to run. The option --repl opens a command shell.  The last option --editor opens the GUI.  Let's try the command shell. 

java -jar JFuzuli.jar --repl
F: 

The prompt F: waits for a convenient Fuzuli expression. Now we can try some basic commands:

F: (+ 2 7)
9.0
F: (- 7 10)
-3.0
F: (require "lang.nfl")
0.0
F: (let mylist '(1 2 3))
[1.0, 2.0, 3.0]
F: (first mylist)
1.0
F: (last mylist)
3.0
F: (length mylist)
3
F: (nth mylist 0)
1.0
F: (nth mylist 1)
2.0


Well, we introduce some basic operators, data types and commands here but not all of them. We always put an operator or command after an opening parenthesis, arguments follow this operator and a closing parenthesis takes place. This is the well-known syntax of LISP and Scheme. So what is the language properties, what are the commands, how to try more Fuzuli codes in JFuzuli??

Fuzuli Language home page: http://fuzuliproject.org/
Have a nice read!


Friday, March 13, 2015

Migration of RCaller and Fuzuli Projects to GitHub

Since Google announced that they are shutting down the code hosting service 'Google code' in which our two projects RCaller and Fuzuli Programming Language are hosted.

We migrated our projects into the popular code hosting site GitHub.

Source code of these projects will no longer be committed in Google code site. Please check the new repositories.

GitHub pages are listed below:





RCaller:

https://github.com/jbytecode/rcaller




Fuzuli Project:

https://github.com/jbytecode/fuzuli



Monday, July 28, 2014

Passing Fuzuli Expressions to Functions

Fuzuli Programming Language has many features borrowed from many popular languages such as C and Java as well as Lisp and Scheme.

It is known that a function pointer can be passed to a function in C and C++, whereas, we must declare the structure of a function using interfaces for doing same job in Java.

In Fuzuli, a Fuzuli source code can be directly passed to a function. This feature allows us to create generic functions easly. Let's show it using an example.

The code below creates four expressions that sum, subtract, product and divide two numbers, respectively.


(let expr1 (expression (+ a b)))
(let expr2 (expression (- a b)))
(let expr3 (expression (* a b)))
(let expr4 (expression (/ a b)))


The expression directive defines a runnable code using the directive eval as we will see later. Let's define a generic function that changes its behaviour respect to a expression parameter:

(function generic_function (params e x y)
   (let a x)
   (let b y)
   (return (eval e))
)


The function generic_function takes three parameters. The first one defines the real action. x and y are parameters that will be passed to expression later. Let's call this generic function using previously defined expressions:

(let enter "\n")
(let x1 15)(let x2 5)
(print "x1=" x1 ", x2=" x2 enter)
(print "+ : " (generic_function expr1 x1 x2) enter)
(print "- : " (generic_function expr2 x1 x2) enter)
(print "* : " (generic_function expr3 x1 x2) enter)
(print "/ : " (generic_function expr4 x1 x2) enter)

In first line we define the enter variable for printing output with line feed. In second line, we set x1 to 15 and x2 to 5. In third line, we are reporting the values of these variables.

The whole story lies at last four lines. In line four, we are calling the function generic_function using the predefined summation expression. In the next line, the same function is called using a different expression which calculates x1 - x2 . As it is clear to see that, last two lines calls the same generic function using two different expressions for getting the product and division of two numbers, respectively.

The output is :

x1=15.0, x2=5.0
+ : 20.0       
- : 10.0       
* : 75.0       
/ : 3.0        



Happy readings...


Notes:

You can try this code using the online interpreter: http://fuzuliproject.org/index.php?node=tryonline
or you can download the JFuzuli Editor: http://mhsatman.com/fuzuli-programming-language-facebook-face/


Sunday, July 27, 2014

Fuzuli Programming Language and Editor

Our programming language, Fuzuli, now has a new interpreter written in Java which is officially called JFuzuli.

You can try it online at site http://fuzuliproject.org/index.php?node=tryonline

We also get our first JFuzuli Editor ready for downloading at https://drive.google.com/file/d/0B-sn_YiTiFLGRHdVSUQ2cFZyT0U/edit?usp=sharing

Please feel free and do not hesisate to share your thoughts about the language and the interpreter.

You can also visit the Facebook page which is aimed to inform Turkish users using the address https://www.facebook.com/FuzuliProgramlamaDiliVeYorumlayici?ref=hl