Giter VIP home page Giter VIP logo

smop's Introduction

Pythonic Small Matlab to Python Compiler

Pythonic SMOP is a tool to translate MATLAB code into Python code. Pythonic SMOP is a fork of SMOP that aims to make four improvements:

  1. Produce code that uses Python syntax instead of MATLAB syntax. This removes the reliance on the original MATLAB files that is present in SMOP.
  2. Remove the dependency on a large library to emulate MATLAB behavior. Currenly, only a 30 line Python file is needed initially. The reliance on this file can and should be removed, but must be done by hand.
  3. Allow translation of MATLAB functions to Python functions.
  4. Fix bugs and improve parsing.

Installation

Pythonic SMOP can currently only be installed through downloads or clones of this repository.

Usage

Pythonic SMOP is run by calling main.py. Running this without flags will list the description for all possible flags. To run a basic translation, use python main.py INPUT_FILE.m -o OUTPUT_FILE.py.

If the outputted file uses arrays, there should be import smop_util near the top of the file. This includes just one function that is used to emulate MATLAB's ability to expand arrays by assigning a value to an element beyond the bounds of the array. To keep this functionality, place smop_util.py in the folder same folder as the generated Python file before running it. In most cases, the Python code should be edited to manually set the bounds of the array. This must be done manually, since it is difficult if not impossible to find the proper max bounds of an array by reading the MATLAB code. Once this is done, all references to smop_util.py can be removed by replacing safe_set function calls with assignment expressions.

smop's People

Contributors

alexg31 avatar iglesias avatar johnyf avatar patrickfuri avatar perimosocordiae avatar victorlei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.