Neucomp
Jump to navigation
Jump to search
Neucomp is short for Neumann stiled Computer.
Examples for a Computer
Add 2 and 2
Let 1 2 Let 2 2 ALU 1 2 + 3 Out 3
Outputs 4
.
Cmds
Intruction | Description |
---|---|
Let a b
|
Let a in memory equal b |
ALU a b operation d
|
Let d in memory equal a operation b |
In a
|
Accept input into a |
Out a
|
Output a in numbers |
If a operation b
|
If a operation b equals true then read intrutions in If
until end |
Prt a
|
Prt a’s ASCII value |
Go a
|
Goto line a |
Val a
|
Value at a |
Halt
|
End program |
End
|
End If |
#
|
Comment |
Examples
Hello World
Let 1 72 #H Let 2 101 #e Let 3 108 #ll Let 4 111 #o Let 5 32 # Let 6 87 #W Let 7 114 #r Let 8 100 #d Prt 1 Prt 2 Prt 3 Prt 3 Prt 4 Prt 5 Prt 6 Prt 4 Prt 7 Prt 3 Prt 8
Explenation
Hello World into ASCII is
72 101 108 108 111 32 87 111 114 108 100
cat
Let 1 1 Let 2 2 Let 10 10 ALU 2 1 + 2 In Val 2 If Val 2 = 10 Go 10 End Go 3 Let 2 2 ALU 2 1 + 2 If Val 2 = 10 Halt End Prt Val 2 Go 11
Input H
, i
, and Enter
.
Outputs: Hi
.
Explanation
ALU
adds 1 to var2.
Go
3 is a loop.
If
breaks the loop.
Truth Machine
In 10 Let 0 48 Let 1 49 If 10 = 0 Prt 10 End If 10 = 1 Prt 10 Go 8 End
Looping Counter
This program implements a looping counter which commences at inclusive one (1) and terminates with inclusive ten (10):
Let 0 0 # The constant 0, employed for termination tests. Let 1 1 # The constant 1, employed for counter decrementations. Let 2 10 # The tally of lines to print. Let 3 0 # The current line index, commences from 1. Let 4 0 # The tally of asterisks printed on the current line. Let 5 42 # The ASCII code of the asterisk symbol '*'. Let 6 10 # The ASCII code of the newline character. # Line 8: If 2 = 0 Halt End # Increment current line index. ALU 3 1 + 3 # Adjust number of asterisks to print to conflate with line index. Let 4 Val 3 # Line 13: If 4 > 0 Prt 5 ALU 4 1 - 4 Go 13 End Prt 6 # Decrement number of remaining lines to print. ALU 2 1 - 2 Go 8
Interpreter
- Common Lisp implementation of the Neucomp programming language.