Git Product home page Git Product logo

stck's Introduction

software engineer. dev.
making music under free licenses.
trying to improve my C and Rust skills.
arch user btw.

stck's People

Contributors

ballasi avatar

Watchers

 avatar

stck's Issues

Re-factorization of the code

The code requires severe cleanup as it is some sort of a mess right now. Some work has already been done for the commands but there is still work to do.

Here is the target structure for the project:

src
├── commands
│   ├── command1.h
│   ├── ...
│   └── commandN.h
├── utils
│   ├── log.c
│   ├── log.h
│   ├── stack.c
│   ├── stack.h
│   ├── hashmap.c
│   └── hashmap.h
├── commands.c
├── commands.h
├── stck.c
├── stck.h
├── utils.h
└── main.c

Some functions are also quite long and unbearable to look at, documenting and commenting the code is also a todo.

Re-factorization road-map:

  • Commands
  • Utils
  • Moving variable to hashmap
  • Seperating main.c to stck.c
  • Rewriting main.c and stck.c/.h
  • Moving useful values to utils.h

Add a second stack

Right now, stck only uses one main stack, but in the future, I am interested in implementing a new stack with the { and } commands.

Rather than having one stack for the whole program, it will have a second one. The first stack is the execution process and is never meant to be removed, it is basically the stack that is currently in use by the program at its current form.

When the { command is called, it will add another stack (called the "child" process). Child processes are not executed and are popped when the } command is called (only command executed by child processes), returning to the execution stack.

I have to see how it is meant to work as this is supposed to be an entry-point in making functions, if/while calls and many more. A nice thing that could be done is to work with parentheses:

name ( v ) { content }

In any case, once the } command is called, it keeps the child stack, pops everything between the parentheses in the execution, pops name. Here, the program can behave differently depending on the value of if:

  • if: in that case it applies the elements on the child process if v is true
  • while: unsure of the implementation (because other children processes might happen in a while, essentially destroying the child process, maybe it is a good idea to keep it in an functional PL way without any while but with recursion? another way would be to implement it in a completely other way)
  • any other name: copies the stack to a hashmap of key=name and value=(args, content) where args=v

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.