https://github.com/naveendanj/pear-v2
My own programming language. Completely different from its earlier version pear 1.00. Written using python
https://github.com/naveendanj/pear-v2
Last synced: 2 months ago
JSON representation
My own programming language. Completely different from its earlier version pear 1.00. Written using python
- Host: GitHub
- URL: https://github.com/naveendanj/pear-v2
- Owner: NaveenDanj
- Created: 2022-12-17T07:24:26.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-27T06:06:29.000Z (over 2 years ago)
- Last Synced: 2025-03-19T20:45:36.440Z (3 months ago)
- Language: Python
- Size: 115 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pear Programming Language (v2.0.0)
## Introduction
This language is written by me using python. This Language is using intrepreter. All components (Lexer , Parser , Runtime) is written by me. In this language i have tried to reduce the complexity of the code and tried to implement the syntax similar to the psuedo code so its easier to build a code by just looking at the algorithm. Currently supporting String , int , float , boolean data types. Still in the experimental stage.
## Installation
Installing Pear to your windows operating system is fairly easy.1) First Download the latest version of pear from our [official github repository](https://github.com/NaveenDanj/pear-v2/releases).
2) Exctract the pear binary to the root of the C drive.
3) Add Pear binary file path to your environment variable.### Run Pear script
```
Simply run the command 'pear filename.pr'
```# Examples
## Find maximum number
```
@startvar float n1 = float( input('Enter number 1 : ') )
var float n2 = float( input('Enter number 2 : ') )
var float n3 = float( input('Enter number 3 : ') )if var['n1'] > var['n2']
if var['n1'] > var['n3']
print 'max number is : ' + str( var['n1'] )
else
print 'max number is : ' + str( var['n3'] )
endifelse
if var['n2'] > var['n3']
if var['n2'] > var['n1']
print 'max number is : ' + str( var['n2'] )else
print 'max number is : ' + str( var['n1'] )
endifelse
if var['n3'] > var['n1']
print 'max number is : ' + str( var['n3'] )else
print 'max number is : ' + str( var['n1'] )
endifendif
endif
@end
```
## Factorial of a given number
```
@start
var int n = int( input('Enter number 1 : ') )
var int total = 1while var['n'] > 0
set var['total'] = var['total'] * var['n']
set var['n'] = var['n'] - 1
endwhileprint 'Factorial is ' + str(var['total'])
@end
```
## Pear Function Example
```
@startfunction sum (int param1 , int param2) ->
print 'total is : ' + str( var('param1') + var('param2') )
endfunctionfunction InputNumbers () ->
print 'Sum Of Two Numbers : '
var int x1 = int( input(' Enter n1 : ') )
var int x2 = int( input(' Enter n2 : ') )
call sum ->( var('x1') , var('x2') )
endfunction
call InputNumbers ->()print 'Done'
@end
```