help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a command that shows the C-code the interpreter creates?


From: Andrew Janke
Subject: Re: Is there a command that shows the C-code the interpreter creates?
Date: Fri, 19 Apr 2019 01:16:39 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 4/18/19 12:13 PM, GoSim wrote:
> http://octave.1599824.n4.nabble.com/compile-m-file-loops-nested-loops-more-comprehensive-solution-td4691043.html
> 
> this is an older post where I solved nested loops, I thought ints and
> doubles were different in octave then, but the idea is the same.
> 

If you actually want to do this, you might have better luck writing it
as an Octave package rather than waiting for the core Octave interpreter
to grow this functionality. You could start with one of these ANTLR
grammars for Matlab:

https://www.mathworks.com/matlabcentral/fileexchange/32769-mparser
https://github.com/antlr/grammars-v4/tree/master/matlab

and modify it to support Octave's dialect. ANTLR can build parse tree
data structures, not just execute parsing. (Of course, anything that can
execute parsing could also be used to build a parse tree, by having it
create parse tree nodes as its action on visiting each parse token or
whatever.) That could be the basis for an IR on which you do the
transformations.

For that matter, contributing an Octave grammar to that ANTLR grammars
repo or as a standalone project might be a fun project for someone who
knows Octave well. That could be useful as a basis for a linter, code
formatter, etc., in addition to this C/C++ converter. Those could work
as Octave packages since the Octave interpreter and desktop
automatically pick up changes to "externally" modified files.

Cheers,
Andrew



reply via email to

[Prev in Thread] Current Thread [Next in Thread]