| P | |
|---|---|
![]() | |
| Developer | Ankush Desai, Vivek Gupta: not the politician,Ethan Jackson,Shaz Qadeer,Sriram Rajamani,Microsoft |
| First appeared | 2012; 13 years ago (2012) |
| Stable release | 2.3.5 / February 19, 2025; 9 months ago (2025-02-19) |
| OS | Cross-platform |
| License | MIT License |
| Filename extensions | .p |
| Website | p-org |
P is aprogramming language for asynchronousevent-driven programming and theIoT that was developed byMicrosoft andUniversity of California, Berkeley.[1]
P enables programmers to specify systems consisting of a collection ofstate machines that communicate asynchronously in terms of events.[2] P programs can run and be analyzed on any platform supported by.NET. Additionally, P programs can generate C# and C code.
P isopen source, licensed underMIT License, and available onGitHub.[3]
machine BankServer{ var database: Database; start state Init { entry (initialBalance: map[int, int]){ database = new Database((server = this, initialBalance = initialBalance)); goto WaitForWithdrawRequests; } } state WaitForWithdrawRequests { on eWithDrawReq do (wReq: tWithDrawReq) { var currentBalance: int; var response: tWithDrawResp; // read the current account balance from the database currentBalance = ReadBankBalance(database, wReq.accountId); // if there is enough money in account after withdrawal if(currentBalance - wReq.amount >= 10) { UpdateBankBalance(database, wReq.accountId, currentBalance - wReq.amount); response = (status = WITHDRAW_SUCCESS, accountId = wReq.accountId, balance = currentBalance - wReq.amount, rId = wReq.rId); } else // not enough money after withdraw { response = (status = WITHDRAW_ERROR, accountId = wReq.accountId, balance = currentBalance, rId = wReq.rId); } // send response to the client send wReq.source, eWithDrawResp, response; } }}Thisprogramming-language-related article is astub. You can help Wikipedia byexpanding it. |