Skip to content

dmac100/reversiblevm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReversibleVM

An editor and virtual machine for a JavaScript like language that allows running a program backwards and forwards, with an animated graphical visualisation.

Screenshot

For example, a sorting algorithm can be displayed using:

@delay(transition: 50, instruction: 2);

a = [7, 3, 1, 8, 4, 6, 2, 6, 2, 3, 8, 1, 10, 7, 3, 6, 2, 3, 8, 1];
a = a.map(x => { value: x });

@for(item <- a)
	@rect(
		x: 40,
		y: 15 * a.indexOf(item) + 20,
		width: 20 * item.value,
		height: 8,
		fill: a.indexOf(item) < x ? 'green' : 'red',
		strokeWidth: 1,
		stroke: '#333'
	);

for(var x = 0; x < a.length(); x++) {
	for(var y = x; y < a.length(); y++) {
		if(a[x].value > a[y].value) {
			@vizUpdatesOff;
			var t = a[x];
			a[x] = a[y];
			a[y] = t;
			@vizUpdatesOn;
		}
	}
}

Features

  • Run program backwards and forwards one line or visual change at a time.
  • Visualize state of program with declarative language.
  • Animation of transitions between states, and automatic update when values change.
  • Interactive console to evaluate expressions.
  • Tooltips to see value of variables within the execution of a program.
  • Slider to move program state forwards and backwards.

Installation

Usage

java -jar reversiblevm.jar [-f filename] [-g] [-h] [filename]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published