Giter Site home page Giter Site logo

monty's Introduction

on second thought, let's not go to camelot

Monty

Description

This is a program built to interpret Monty-like scripted files according to operation codes provided to us in the project.

Formatting and Examples

Format for user to write in "testfile.m": opcode argument

NOTE: No more than one instruction per line is allowed, there can however be as many spaces, new lines or tabs before or after the instruction.

Allowable opcodes and what they do

opcode functionality
push add element to the 'top' of stack and 'end' of queue
pop remove element from 'top' of stack and 'end' of queue
pall print every member of the structure
pint prints the member value at the top of stack
swap swaps the order of the 1st and 2nd elements in stack
add add top two member values
sub subtract the top element from the 2nd top element
div divide the 2nd element by the top element
mul multiply the top two elements of the stack
mod the remainder when the 2nd element is divided by the top element
comment there is the ability to parse comments found in bytecode ->'#'
pchar print character at the top of the stack
pstr print the character at the top of the stack
rotl moves element at the top to the bottom of the stack
rotr the bottom of the stack becomes the top
queue, stack toggles the doubly link list implementation style
nop opcode should do nothing

Examples: $ cat opcodetestfile.m

push 1

push 2

push 3

pall

$ ./montyfile opcodetestfile.m

3

2

1

$


$ cat opcodetestfile.m

push 1

push 2

push 3

pall

rotl

pall

$ ./montyfile opcodetestfile.m

3

2

1

2

1

3


$ cat opcodetestfile.m

push 4

push 5

push 18

push 3

pall

sub

pall

$ ./montyfile opcodetestfile.m

3

18

5

4

15

5

4


File List

File Name Description
README.md Provides details regarding functionality and creation of our version of a monty program (present file)
main.c The entry point of our interpreter, recieves data and initializes data struct
init.c This is where data gets read and processed, data is read from file and added to our data structure accordingly
mathops.c All the functions to perform math operations on the data structure members
string_ops.c Contains operations for string manipulation
opfuncs.c, opfuncs2.c these files contain functionality for basic bytecode operations (pop, push, etc..)
printops.c operatons to print members from data structure
check_input.c checks the type of input given to resolve errors

Flow chart

flow chart

Exit Status

Exits with status EXIT_FAILURE

Compilation

All files were compiled on Ubuntu 14.04 LTS.

All programs and functions were compiled with gcc 4.8.4 using flags -Wall -Werror -Wextra and -pedantic.

Styling

All files have been written in the Betty Style.

Authors

monty's People

Contributors

derric-d avatar tabbykatz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.