Reversible programming language: Difference between revisions

Content deleted Content added
Line 273:
}}</ref>
 
===Design philosophy===
'''Design Philosophy:''' Janus embodies the principle of local invertibility. It operates on a global store of variables (no heap allocation or local procedure scope in early versions) and ensures that every statement has a unique inverse.<ref>{{cite web
| last1 = Choudhury
| first1 = Vikraman
Line 283 ⟶ 284:
}}</ref>
 
'''===Syntax and Semantics:'''semantics===
* ''Program Structure:'' A Janus program consists of global variable declarations followed by procedure declarations. The execution starts at a procedure named <code>main</code>, or the last procedure defined if <code>main</code> is absent.<ref>{{cite web |url=https://en.wikipedia.org/wiki/Janus_(time-reversible_computing_programming_language) |title=Janus (time-reversible computing programming language) |website=Wikipedia |access-date=April 9, 2025}}</ref>
* ''Data Types:'' Janus primarily uses 32-bit integers (interpreters may differ on signed vs. unsigned) and one-dimensional integer arrays of fixed size.<ref>{{cite conference
Line 449 ⟶ 450:
** '''Sequence:''' <code>s1; s2</code>. The inverse is <code>s2<sup>−1</sup>; s1<sup>−1</sup></code>.<ref>{{cite web |url=https://en.wikipedia.org/wiki/Janus_(time-reversible_computing_programming_language) |title=Janus (time-reversible computing programming language) |website=Wikipedia |access-date=April 9, 2025}}</ref>
 
===Implementations and code examples===
'''Implementations and Code Examples:''' Several online interpreters for Janus exist.<ref>{{cite web |url=https://topps.diku.dk/pirc/?id=janus |title=Janus: a reversible imperative programming language |website=University of Copenhagen (DIKU) |access-date=April 9, 2025}}</ref> Janus has been used to implement various algorithms reversibly, including computing Fibonacci pairs<ref>{{cite conference
| last1 = Yokoyama
| first1 = Tetsuo
Line 579 ⟶ 581:
}}</ref>
 
'''===Syntax and Semantics:'''semantics===
* ''Program Structure:'' Programs are defined using <code>(defmain ...)</code> for the main routine and <code>(defsub ...)</code> for subroutines. Global variables and arrays are declared with <code>(defword ...)</code> and <code>(defarray ...)</code>.<ref>{{cite web
| last1 = Choudhury
Line 654 ⟶ 656:
}}</ref> These are inherently irreversible operations.
 
'''===Pendulum/PISA Target Architecture:'''target architecture===
The R language was designed with a specific hardware target: the Pendulum processor.<ref>{{cite thesis
| last1 = Frank
| first1 = Michael P.
Line 747 ⟶ 750:
}}</ref>
 
'''===Code Examples:'''examples===
 
The following PISA assembly code<ref>{{cite conference