P (programming language): Difference between revisions

Content deleted Content added
Copyedit.
Adding local short description: "Event-driven programming language", overriding Wikidata description "programming language"
 
(22 intermediate revisions by 13 users not shown)
Line 1:
{{Short description|Event-driven programming language}}
{{Infobox programming language
| name = P
| logo = P =logo.png
| logo_size = 120px
| logo size =
| logo altcaption = =
| paradigm = =
| logo caption =
| designer = =
| paradigm =
| developer = Ankush =Desai, Vivek Gupta: not the politician, [[Ethan Jackson]], [[Shaz Qadeer]], [[Sriram Rajamani]], [[Microsoft]]
| designer =
| latest release version = 2.3.5
| developer = Vivek Gupta: not the politician, [[Ethan Jackson]], [[Shaz Qadeer]], [[Sriram Rajamani]], [[Microsoft]]
| latest release versiondate = {{Start date and age|2025|02|19}}
| typing =
| latest release date = {{start date and age|2012|11}}
| implementations = =
| typing =
| dialects = =
| implementations =
| influenced = =
| dialects =
| operating system = [[Cross-platform]]
| influenced =
| latest release date year = {{startStart date and age|2012|11}}
| operating system = [[Cross-platform]]
| turing-complete = Yes
| year = {{start date and age|2012}}
| influenced_by = =
| turing-complete = Yes
| file ext = .p
| influenced_by =
| license = [[MIT License]]
| file ext = .p
| website = {{url|https://p-org.github.io/P/}}
| wikibooks =
}}
 
'''P''' is a [[programming language]] for asynchronous [[event-driven programming]] and the [[Internet of things|IoT]] that was developed by [[Microsoft]] and [[University of California, Berkeley]].<ref>[https://www.infoworld.com/article/3130998/microsoft-open-sources-p-language-for-iot.html Microsoft open-sources P language for IoT]</ref>
 
P enables programmers to specify systems consisting of a collection of [[finite state machine|state machines]]s that communicate asynchronously in terms of events.<ref>{{cite web |url=https://www.microsoft.com/en-us/research/publication/p-safe-asynchronous-event-driven-programming/ |title=P: Safe Asynchronous Event-Driven Programming |authorsauthor=Ankush Desai |author2=Vivek Gupta, |author3=Ethan Jackson, |author4=Shaz Qadeer and |author5=Sriram Rajamani |accessdatewebsite=[[Microsoft]] |date=November 2012 |access-date=20 February 2017}}</ref> P Codeprograms can be run onand [[Microsoftbe Windows]]analyzed andon [[Windowsany Phone]],platform andsupported is nowby [[open-source model|open source.NET]].<ref>{{cite web|last1=SergioAdditionally, DeP Simone|title=Microsoftprograms Open-Sourcescan Pgenerate LanguageC# forand SafeC Async Event-Driven Programming|url=https://wwwcode.infoq.com/news/2016/10/microsoft-p-language-opensourced|website=InfoQ|accessdate=20 October 2016}}</ref>
 
P is [[open-source model|open source]], licensed under [[MIT License]], and available on [[GitHub]].<ref>{{cite web|last1=Sergio De Simone|title=Microsoft Open-Sources P Language for Safe Async Event-Driven Programming|url=https://www.infoq.com/news/2016/10/microsoft-p-language-opensourced|website=InfoQ|access-date=20 October 2016}}</ref>
 
== Example ==
<pre>
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;
}
}
}
</pre>
 
== See also ==
{{Portal|Free and open-source software}}
* [[Microsoft Research]]
* [[Category:Free software movement]]
 
== References ==
{{reflistReflist}}
 
* P: Safe asynchronous event-driven programming. Ankush Desai, Vivek Gupta, Ethan Jackson, Shaz Qadeer, Sriram Rajamani, and Damien Zufferey. In Proceedings of ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), 2013.
== Further reading ==
* P: Safe asynchronous event-driven programming. Ankush Desai, Vivek Gupta, Ethan Jackson, Shaz Qadeer, Sriram Rajamani, and Damien Zufferey. In Proceedings of [[Association for Computing Machinery|ACM]] [[SIGPLAN]] Conference on [[Programming Language Design and Implementation]] (PLDI), 2013.
* Systematic testing of asynchronous reactive systems. Ankush Desai, Shaz Qadeer, and Sanjit A. Seshia. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering (ESEC/FSE 2015).
* Building Reliable Distributed Systems With P. Ankush Desai, Ethan Jackson, Amar Phanishayee, Shaz Qadeer and Sanjit A. Seshia. [[University of California, Berkeley]]. Technical Report No. UCB/EECS-2015-198.
 
== External links ==
* {{Official website|https://github.com/p-org.github.io/P/}}
* {{URL|https://github.com/p-org/P|Source code on GitHub}}
* https://www.microsoft.com/en-us/research/publication/p-safe-asynchronous-event-driven-programming/
* [https://www.microsoft.com/en-us/research/blogpublication/p-programmingsafe-languageasynchronous-asynchronyevent-driven-programming/ P: Safe Asynchronous Event-Driven Programming]
* [https://www.microsoft.com/en-us/research/blog/p-programming-language-asynchrony/ P: A programming language designed for asynchrony, fault-tolerance and uncertainty]
 
[[Category:{{Programming languages]]}}
{{Microsoft FOSS}}
[[Category:Free software]]
{{Microsoft development tools}}
{{Microsoft Research}}
 
[[Category:Free and open-source software]]
[[Category:Microsoft free software]]
[[Category:Microsoft programming languages]]
[[Category:Programming languages created in 2012]]
[[Category:Software using the MIT license]]
[[Category:Systems programming languages]]
[[Category:2012 software]]
[[Category:Programming languages created in 2012]]