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

CAST translation of MATLAB functions #562

Closed
jastier opened this issue Oct 10, 2023 · 0 comments · Fixed by #671
Closed

CAST translation of MATLAB functions #562

jastier opened this issue Oct 10, 2023 · 0 comments · Fixed by #671
Assignees
Labels
CI continuous integration and automated workflows Code2FN lang/MATLAB Used for work related to MATLAB frontend

Comments

@jastier
Copy link
Contributor

jastier commented Oct 10, 2023

CAST translation of MATLAB functions

Implement CAST for the following:

function addition_demo = both(x, y)
    both = x + y;
end

y = addition_demo(1, 3);

Matlab Tree-sitter syntax nodes to support:

  • function_definition
  • function_output
  • function_arguments
  • function_call (done)
@jastier jastier added Code2FN CI continuous integration and automated workflows lang/MATLAB Used for work related to MATLAB frontend labels Oct 10, 2023
@jastier jastier added this to the [DARPA] Milestone 10 milestone Oct 10, 2023
@jastier jastier self-assigned this Oct 10, 2023
@jastier jastier removed this from the [DARPA] Milestone 10 milestone Oct 12, 2023
@jastier jastier changed the title Support Tree-sitter MATLAB function definitions Support Tree-sitter MATLAB functions Nov 12, 2023
jastier added a commit that referenced this issue Nov 14, 2023
## MATLAB function call, operator and matrix support, code cleanup
This PR adds support for Operators, matrix literals, and function calls.
I also got rid of some old Fortran routines that didn't work with
MATLAB. Added support for some Operator types, we now support four of
them and have three remaining. Those are going to have to be resolved by
translating them to CAST loop constructs.

## Relevant features:
- Added Operator support (Boolean, comparison, unary)
- Added function call node support
- Added n-dimensional matrix support for all primitive types
- Added new CI test cases for all of the above
- Added a file with Waterloo model Tree-sitter syntax tokens

## Bugfixes
- Fixed a bug where CAST output was getting wrapped in an extra list.
- Fixed a bug were the source_refs node wasn't getting included on
certain structures. Our CI now checks them all.

## Related issues
Resolves #590 #635 #636
Work towards #562

---------

Co-authored-by: Joseph Astier <[email protected]>
Co-authored-by: Gus Hahn-Powell <[email protected]>
github-actions bot added a commit that referenced this issue Nov 14, 2023
## MATLAB function call, operator and matrix support, code cleanup
This PR adds support for Operators, matrix literals, and function calls.
I also got rid of some old Fortran routines that didn't work with
MATLAB. Added support for some Operator types, we now support four of
them and have three remaining. Those are going to have to be resolved by
translating them to CAST loop constructs.

## Relevant features:
- Added Operator support (Boolean, comparison, unary)
- Added function call node support
- Added n-dimensional matrix support for all primitive types
- Added new CI test cases for all of the above
- Added a file with Waterloo model Tree-sitter syntax tokens

## Bugfixes
- Fixed a bug where CAST output was getting wrapped in an extra list.
- Fixed a bug were the source_refs node wasn't getting included on
certain structures. Our CI now checks them all.

## Related issues
Resolves #590 #635 #636
Work towards #562

---------

Co-authored-by: Joseph Astier <[email protected]>
Co-authored-by: Gus Hahn-Powell <[email protected]> d193a52
@jastier jastier changed the title Support Tree-sitter MATLAB functions CAST translation of MATLAB functions Nov 14, 2023
jastier added a commit that referenced this issue Nov 17, 2023
## Matrix and list handling bugfixes, improved testing
This PR fixes an issue with matrix handling where nested empty matrices
would be represented as a single empty matrix. We now show the empty
matrices in their correct nested positions. Also some better CI testing.
Instead of picking off individual fields to test, the only input now is
another instance of the same class the way it should look, and the code
will check it in one go. Added function call tests with operators and
other functions as arguments.

## Relevant features
- Correct representation of empty matrices.
- CI testing with class instances.  More test cases.

 ## Related issues
Partially addresses #562

---------

Co-authored-by: Joseph Astier <[email protected]>
github-actions bot added a commit that referenced this issue Nov 18, 2023
## Matrix and list handling bugfixes, improved testing
This PR fixes an issue with matrix handling where nested empty matrices
would be represented as a single empty matrix. We now show the empty
matrices in their correct nested positions. Also some better CI testing.
Instead of picking off individual fields to test, the only input now is
another instance of the same class the way it should look, and the code
will check it in one go. Added function call tests with operators and
other functions as arguments.

## Relevant features
- Correct representation of empty matrices.
- CI testing with class instances.  More test cases.

 ## Related issues
Partially addresses #562

---------

Co-authored-by: Joseph Astier <[email protected]> f4eedfc
jastier added a commit that referenced this issue Nov 20, 2023
## Summary of Changes
This PR extends our coverage of MATLAB to include functions and
commands. Add some more test cases to reinforce existing test classes.
The Waterloo Model will now fully translate without 'None' values in the
output

##  Relevant Features
- Added function and command processing
- Added support for parenthesized nodes
- Added support for all operator types at least to a first order.
- Added PEMDAS checking for sequential arithmetic operators

## Bugfixes
- Fixed a bug where there could be 'None' values in the CAST output

### Related issues
Resolves #562 #647
partially #671

---------

Co-authored-by: Joseph Astier <[email protected]>
github-actions bot added a commit that referenced this issue Nov 20, 2023
## Summary of Changes
This PR extends our coverage of MATLAB to include functions and
commands. Add some more test cases to reinforce existing test classes.
The Waterloo Model will now fully translate without 'None' values in the
output

##  Relevant Features
- Added function and command processing
- Added support for parenthesized nodes
- Added support for all operator types at least to a first order.
- Added PEMDAS checking for sequential arithmetic operators

## Bugfixes
- Fixed a bug where there could be 'None' values in the CAST output

### Related issues
Resolves #562 #647
partially #671

---------

Co-authored-by: Joseph Astier <[email protected]> 03cced3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI continuous integration and automated workflows Code2FN lang/MATLAB Used for work related to MATLAB frontend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant