Skip to content

Releases: NaveenDanj/pear-v2

Pear v2.0.3

27 Dec 05:24
Compare
Choose a tag to compare
Pear v2.0.3 Pre-release
Pre-release

What's new?

With Pear v2.0.3's latest release, we have added a function return feature. In pear return statements work the same as in other functional programming languages. It gives the value of the expression of the return statement. But in order to get the return value of a function, First you'll have to call the function. Then after that, you can get the return value anywhere in the code by using the get keyword.

Example is down below

@start

    function sum (int a , int b) ->
        var int total_ =  var('a') + var('b')
        return var('total_')
    endfunction

    call sum ->(20,4)

    var int total = get sum ->(20,4)
    print 'total is : ' + str( var('total') )
    ~ total is : 24

@end

Full Changelog: v2.0.2...v2.0.3

Pear v2.0.2

26 Dec 06:47
Compare
Choose a tag to compare
Pear v2.0.2 Pre-release
Pre-release

Bug Fixes

Fixed issues in setting variable values in local scope.
In the previous version, There was a issue when you try to change the value of already initialized variable in the local scope. The ecosystem couldn't correctly identify whether the variable is belongs to local scope or global scope, hens compiler throws key error.

In this patch above issue was addressed.

Full Changelog: v2.0.1...v2.0.2

Pear v2.0.1

25 Dec 15:27
Compare
Choose a tag to compare
Pear v2.0.1 Pre-release
Pre-release

What's New ?

In this release we have added function to the ecosystem. Now you can initialize and call functions in Pear. You can also use function as recursively. Every variables initialized inside the functions and function parameters are local scope, In other words you can use those variables only inside the function scope.

function initialization and calling syntax are down below

To initialize a function

function func_name (int param1 , int param2) ->
  ~ function body
endfunction

To call a function

call func_name ->( 20 , 45 )

Breaking changes

Please note that, we have changed the variable reference syntax. From now on, with this new version, The variable reference syntax is down below

Before

var['var_name']

After

var('var_name')

Pear v2.0.0

17 Dec 08:48
Compare
Choose a tag to compare
Pear v2.0.0 Pre-release
Pre-release

Initial release of the pear programming language version 2.0.0