victorlei / smop

Small Matlab to Python compiler
MIT License
1.08k stars 409 forks source link

Added system (!) statement #130

Closed gave92 closed 4 years ago

gave92 commented 6 years ago

Edited parser and lexer to support the syntax to call an external program

! systemcommand

Also added support for the try-catch with named exception:

try
    ...
catch ME
    ...
end
victorlei commented 6 years ago

This pull request contains two unrelated patches -- (1) bang syntax to call external programs and (2) named exceptions. I will discuss these two issues separately.

  1. Is bang syntax understood by matlab and octave? I may be wrong but I think it is not. If this is the case I will appreciate a convincing argument why we need it.

  2. Same as (1)

Victor

gave92 commented 6 years ago

Yes these are both supported by MATLAB https://www.mathworks.com/help/matlab/ref/try.html https://www.mathworks.com/help/matlab/matlab_external/run-external-commands-scripts-and-programs.html This change would allow smop to follow more closely the Matlab semantics.