Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbheard/SimpleLang-interpreter
A simple command line SimpleLang(++) interpreter
https://github.com/jbheard/SimpleLang-interpreter
Last synced: 3 months ago
JSON representation
A simple command line SimpleLang(++) interpreter
- Host: GitHub
- URL: https://github.com/jbheard/SimpleLang-interpreter
- Owner: jbheard
- Created: 2016-10-15T15:26:17.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-11T19:13:37.000Z (over 5 years ago)
- Last Synced: 2024-04-24T15:34:55.574Z (7 months ago)
- Language: C
- Homepage:
- Size: 84 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- AwesomeInterpreter - SimpleLang-interpreter
README
# SimpleLang Interpreter
This is a command line interpreter for a simple, Turing complete, programming language. It can run code from a file or from the command line (interactive mode).
SimpleLang is actually a rebranding of a popular esoteric programming language called brain\. SimpleLang is just a change in name and nothing more, since I didn't want to plaster cuss words all over my online portfolio. Similarly, SimpleLang++ is a rebranding of a lesser known addition to the original language by Jacob I. Torrey. Both languages can be easily found on https://esolangs.org
SimpleLang is an esoteric programming language in which there are only 8 operations, these are as follows:Operation | Explanation
:---: | :---
< | Decrements the data pointer
\> | Increments the data pointer
\- | Decrements the byte at the data pointer
\+ | Increments the byte at the data pointer
\[ | Begins a loop, if byte at data pointer is 0, skip to the command after end of loop
\] | Jump to beginning of loop
\, | Take a single byte of input
\. | Print a the byte at the data pointerAnything that is not one of the above 8 operations is ignored, and can be used to comment.
# SimpleLang++ Interpreter
SimpleLang++ is an addition to SimpleLang, which adds some new operations to extend the usefulness (if it was useful to begin with) and possibilities of the language.The added operations in the SimpleLang++ language are:
Operation | Explanation
:---: | :---
\# | Open a file for reading/writing
; | write the character in the current cell to the file, overwriting what is in the file
: | Read a character from the file
% | Opens a socket for reading/writing. A second call closes the socket.
^ | Sends the character in the current cell
! | Reads a character from socket into current cellThe comment syntax does not change. Any SimpleLang program can be run using SimpleLang++, so long as none of the comments contain any of the new operations.
The actual specification for the SimpleLang++ language (includes how to open files and sockets in more depth) can be found in spec.txt# Building
To build the interpreter use **gcc main.c SimpleLang.c SimpleLangpp.c -o SimpleLang -Werror -Wall -lws2_32** on Windows platforms (using MinGW) and **gcc main.c SimpleLang.c SimpleLangpp.c -o SimpleLang -Werror -Wall** on linux/unix platforms.