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

Error in operator parsing #26

Closed
mrkulk opened this issue Feb 22, 2015 · 6 comments
Closed

Error in operator parsing #26

mrkulk opened this issue Feb 22, 2015 · 6 comments

Comments

@mrkulk
Copy link

mrkulk commented Feb 22, 2015

Here's a simple piece of code which fails:

julia> @matlab begin
       a=2*2*2*2;
       end
 a = *(2, 2, 2, 2);
     |
Error: Unexpected MATLAB operator.

Is the parser restricted to operations on two numbers at a time? The above code is fine with explicit parenthesis around every pair of numbers.

@rundong08
Copy link

I've met the same issue.
@matlab 2*2 will return the correct answer, but @matlab 2*2*2 won't.
It seems that 2*2*2 was parsed into *(2,2,2), which is correct for Julia, but not correct for MATLAB.
A quick and dirty workaround is to add more parenthesis, for example @matlab (2*2)*2 will give you the right answer.

My julia version info is:

Julia Version 0.3.6
Commit 0c24dca (2015-02-17 22:12 UTC)
Platform Info:
  System: Linux (x86_64-unknown-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

@simonster
Copy link
Member

This will work with the new mat string literal.

@musm
Copy link
Collaborator

musm commented Oct 31, 2016

close?

@simonster
Copy link
Member

Well, it's not fixed AFAIK. But we could just deprecate the @matlab macro. Trying to rewrite the Julia AST to make it valid MATLAB was probably not the right approach.

@ChrisRackauckas
Copy link
Collaborator

The string macro seems safer and more expressive, so it's probably best to deprecate the @matlab macro since it's essentially just a trap. Is there any case where it's better than using mat""?

@musm
Copy link
Collaborator

musm commented Aug 22, 2017

closed, @matlab has been deprecated in favor of mat"..."

@musm musm closed this as completed Aug 22, 2017
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

5 participants