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

Support Java code-generation of trap statements #657

Open
peterwvj opened this issue Dec 12, 2017 · 0 comments
Open

Support Java code-generation of trap statements #657

peterwvj opened this issue Dec 12, 2017 · 0 comments
Assignees
Labels
enhancement Not a bug, but nice to have language Issues in parser, TC, interpreter, POG or CG
Milestone

Comments

@peterwvj
Copy link
Member

peterwvj commented Dec 12, 2017

We need Java code-generation of trap statements in the AGCO project. Below are some test scenarios.

class Entry

operations

-- Result is 2  
public noExcRaised : () ==> nat
noExcRaised () ==
trap - with return 6 in
  return 2;

-- Result is 18
public excCaught : () ==> nat
excCaught () ==
trap a with return a + a in
  exit 9;

-- Result is mk_(9, true)  
public excCaughtTupRes : () ==> nat * bool
excCaughtTupRes () ==
trap mk_(b,n) with return mk_(n,b) in
  exit mk_(true, 9);

-- Produces error (exception not caught)
public excNotCaught : () ==> nat * bool
excNotCaught () ==
trap mk_('a', 9) with return mk_(5,false) in
  exit mk_(true, 9);

-- Produces error (exception not caught because 9 does not match 2) 
public excBindNotCaught : () ==> nat
excBindNotCaught () ==
trap s in set {2} with return s
in
  exit 9;

-- Result is 9 
public excBindCaught : () ==> nat
excBindCaught () ==
trap s in set {9} with return s
in
  exit 9;


end Entry
@peterwvj peterwvj added the enhancement Not a bug, but nice to have label Dec 12, 2017
@peterwvj peterwvj added this to the v2.5.8 milestone Dec 12, 2017
@peterwvj peterwvj self-assigned this Dec 12, 2017
@peterwvj peterwvj changed the title Support the trap statement Support Java code-generation of trap statements Dec 12, 2017
@peterwvj peterwvj modified the milestones: v2.6.0, v2.6.2 Feb 16, 2018
@peterwvj peterwvj modified the milestones: v2.6.2, v2.6.4 May 17, 2018
@peterwvj peterwvj modified the milestones: v2.6.4, v2.6.6 Oct 18, 2018
@peterwvj peterwvj modified the milestones: v2.7.0, v2.7.2 Jun 3, 2019
@peterwvj peterwvj modified the milestones: v2.7.2, v2.7.4 Sep 30, 2019
@nickbattle nickbattle added the language Issues in parser, TC, interpreter, POG or CG label Dec 20, 2019
@idhugoid idhugoid modified the milestones: v2.7.4, v3.0.2 Mar 16, 2020
@idhugoid idhugoid modified the milestones: v3.0.0, v3.0.2 Aug 28, 2020
@idhugoid idhugoid modified the milestones: v3.0.2, v3.0.4 Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Not a bug, but nice to have language Issues in parser, TC, interpreter, POG or CG
Projects
None yet
Development

No branches or pull requests

3 participants