A turing-complete programming language to honor our beloved friend, Peyman.
-- in yek commente :D
-- ba chiz moteghayer tarif mikonim
chiz folan = 12;
-- injoori print mishe
chaap folan;
-- injoori voroodi migire
begir folan;
-- while loop ham dare
ta folan < 20 {
-- if else ham dare
agar folan % 2 == 0 {
chaap 1;
} vagarna {
chaap 0;
}
folan += 1;
}
-- string
chaap 'salam donya!';
chiz esm = 'peyman';
chaap esm + ' khar ast';
-- string length
chaap andaze(esm);
-- string get item
chaap esm[0];
chaap esm[1];
chiz akhar = esm[andaze(esm)-1];
chaap akhar;
-- logical and or
agar (folan > 10 va folan < 20) ya folan == 40 {
chaap 200;
}
You can find more samples here.
On Windows machines, you can use PeySetup.
Don't forget to restart your machine after installing. Then open cmd and type:
peyman your_file_name.pey
If it didn't recognize the command, add it manually to PATH variables and retry.
On linux machines, download this.
Don't forget chmod +x peyman
Also you can use docker to build and use Peylang!
git clone https://github.com/amiremohamadi/peylang.git
cd peylang
docker build -t peylang .
docker run -it peylang
we use cmake as build system not anymore!
-
Make sure you have installed all the dependencies:
g++
4.3 or later- GNU
make
git
flex
bison
On an ubuntu machine You can install them like this (but make sure the required version is installing):
$ sudo apt-get -y install git-all build-essential cmake flex bison
- Clone the source with
git
:
$ git clone https://github.com/amiremohamadi/peylang.git
$ cd peylang
- Build & Run:
$ make
$ ./peyman