PScript (Probabilistic Script) is a programming language designed to facilitate the implementation and execution of probabilistic models and computations. It provides a set of syntax and constructs that allow developers to express and manipulate probabilistic distributions, statistical models, and inference algorithms in a concise and intuitive manner.
- It was build using PLY (Python lex yacc).
- Previous work that was used to build this project can be found as SigmaScript, a project developed by members of the current team.
- Basic arithmetic operations
- Basic logical operations
- Basic conditional statements
- Basic loops (while)
- Basic functions
- Basic multidimensional arrays
- Basic variables without type inference
- Basic probability distributions (Exponential, Normal, Uniform, Poisson, Geometric)
- Stochastic variables (when the variable is called, always returns different values)
- Stochastic arrays (when the array is called, always returns different values)
- Console input and output
- File input and output un txt format with PScript syntax
-
Clone this repository using :
git clone https://github.com/jumorap/PScript
-
Move into the repository using:
cd PScript
-
Install the required packages using:
pip install -r requirements.txt
-
Write PScript in the
scripts
folder and save it as<file_name>.psc
. -
Run your code using :
python3 pscript.py scripts/<file_name>.psc -t
where
-t
is a flag to show each token generated by the lexer.- To only show the output of the program you can also run the code using:
python3 pscript.py scripts/<file_name>.psc
- To write and run PScript code through the terminal line by line you can also run the code using:
python3 pscript.py
- To only show the output of the program you can also run the code using:
- The
scripts
folder contains some examples of PScript code. - You can run some examples of PScript using:
python3 pscript.py scripts/while_bucle.psc