Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Matlab Lexer & Parser #179

Open
RobBW opened this issue Nov 29, 2021 · 5 comments
Open

New Matlab Lexer & Parser #179

RobBW opened this issue Nov 29, 2021 · 5 comments

Comments

@RobBW
Copy link

RobBW commented Nov 29, 2021

There is a new and open source tool for parsing and lexing Matlab at:https://misshit.org
Github repository at https://github.com/florianschanda/miss_hit
It is described as follows:

"There have been other attempts at this, but MISS_HIT tries to do things differently (and I hope better).
Specifically:
• It is completely stand-alone. It does not require a working MATLAB or Octave setup.
• It is not just a bag of reg-ex, or a wrapper arounds some undocumented MATLAB internals. It is based on a feature complete lexer and parser, which supports every single weird feature of the MATLAB language.
• It contains features specifically for huge industrial code-bases (i.e. millions of lines): multi-threaded analysis and a sophisticated configuration and justification mechanism.
• Designed for both interactive use during development, and integration into modern CI environments."_

It will undoubtedly be a good resource for people wanting to extend the capabilities of smop.

@Helveg
Copy link

Helveg commented Dec 13, 2021

Do you have any idea how to use it though? It promotes a couple of CLI tools but doesn't really go into much detail for the lexing/parsing. I see there's a fork that's trying to implement something for parsing to Python: https://github.com/chaoqing/miss_hit/blob/9304eb2800681fa2bcfe5a18fc3a5d898d1da35d/miss_hit_core/m_ast.py#L3358

@florianschanda
Copy link

Hey. :)

Lexing and parsing is fully complete with all features of MATLAB (even the dumb ones) supported. What is not working yet is semantic analysis (i.e. name resolution and type inference). I am very happy to assist you or answer any questions you might have to get something working.

It's enough to write a bunch of tools (code formatter, code metrics, linter, etc.) but to do more interesting things (like code generation) I still need to put in place a lot of code.

Generally the focus is completeness and correctness over "do everything fast but only for a small subset".

@Helveg
Copy link

Helveg commented Jan 25, 2022

That's a nice focus for the project! For the SMOP community what is going to matter most is translation of MATLAB code into equivalent Python code. I saw someone with a fork who is trying to do just that. How would one go about using the project for transpilation purposes?

@RobBW
Copy link
Author

RobBW commented Apr 10, 2022

You can test that fork online here: https://translate.mat2py.org
The underlying code is here: https://github.com/mat2py/mat2py

@chaoqing
Copy link

chaoqing commented May 9, 2022

Hi @RobBW, thanks for linking mat2py. Actually mh_python is responsible for code translating and mat2py is the runtime to evaluate the generated code. Hi @Helveg, you can give a try to this online matlab emulator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants