-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmonty.1
101 lines (72 loc) · 3.01 KB
/
monty.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.TH MONTY 1 "December 2023" Manual "User Commands" Monty Bytecodes Interpreter
.SH NAME
monty \- Monty Bytecode Interpreter
Monty 0.99 is a scripting language that is first compiled into Monty byte codes (Just like Python). It relies on a unique stack and queue, with specific instructions to manipulate it.
.SH SYNOPSIS
.B monty
.I file
.SH DESCRIPTION
The Monty Bytecode Interpreter reads and executes Monty bytecode files. It relies on unique stack and queue with specific instructions to manipulate it.
.SS Monty Bytecode Files
Files containing Monty bytecodes usually have the .m extension. Most of the industry uses this standard but it is not required by the specification of the language. There is not more than one instruction per line. There can be any number of spaces before or after the opcode and its argument.
.SH USAGE
.B monty
.I file
.SH OPTIONS
.IP "file"
The bytecode file to be parsed and executed by the Monty Bytecode Interpreter.
.SH OPCODES
The following opcodes (commands) are supported by the Monty Bytecode Interpreter either for the stack or the queue:
.IP "\fBpush\fR"
Pushes (adds) an element onto the stack.
.IP "\fBpop\fR"
Removes the top element from the stack.
.IP "\fBpint\fR"
Prints the value at the top of the stack.
.IP "\fBpall\fR"
Prints all the elements in the stack.
.IP "\fBadd\fR"
Adds the top two elements of the stack.
.IP "\fBsub\fR"
Subtracts the top element from the second top element of the stack.
.IP "\fBmul\fR"
Multiplies the second top element with the top element of the stack.
.IP "\fBdiv\fR"
Divides the second top element by the top element of the stack.
.IP "\fBmod\fR"
Computes the remainder of the division of the second top element by the top element of the stack.
.IP "\fBswap\fR"
Swaps the top two elements of the stack.
.IP "\fBpchar\fR"
Prints the character at the top of the stack.
.IP "\fBpstr\fR"
Prints the string starting at the top of the stack.
.IP "\fBrotl\fR"
Rotates the stack to the top. The top element of the stack becomes the last one, and the second top element of the stack becomes the first one.
.IP "\fBrotr\fR"
Rotates the stack to the bottom. The last element of the stack becomes the top element of the stack, and the second last element becomes the last one.
.SH EXAMPLES
Execute a Monty bytecode file:
.B monty bytecodes/XYZ.m
.SH EXIT STATUS
The monty opcode exits with the following status codes:
.IP "0"
Successful execution.
.IP "1"
Failure or error during execution
.SH SEE ALSO
The Monty Project repository: <https://github.com/Emyjakarta/monty>
.SH AUTHORS
.IP
Maxwell Nana Forson <[email protected]>
.IP
Decency Chukwuemeka Ukonu <[email protected]>
.SH BUGS
Report bugs to: <https://github.com/Emyjakarta/monty/issues>
.SH COPYRIGHT
This is a free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.SH DISCLAIMER
This man page is provided "as is" without any warranty.
.SH NOTES
This man page is intended to provide a brief overview of the Monty Bytecode Interpreter and its supported opcodes.