~remexre/public-inbox

ableC-diff: Changes in response to changes upsream. v1 APPLIED

~hypnotic_oxbow: 1
 Changes in response to changes upsream.

 5 files changed, 14 insertions(+), 18 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~remexre/public-inbox/patches/31682/mbox | git am -3
Learn more about email & git

[PATCH ableC-diff] Changes in response to changes upsream. Export this patch

From: Ian Kariniemi <i.kariniemi@gmail.com>

Silver,AbleC and other extensions changed upstream, mostly refactoring
and renaming of things. 'Do' syntax was changed, IO,IOMonad ->
IOToken,IO. Movement of grammars occurred too.
---
 .../abstractsyntax/Function.sv                  |  1 -
 .../abstractsyntax/SSANames.sv                  |  2 +-
 .../abstractsyntax/ToSSA.sv                     | 17 ++++++++---------
 .../abstractsyntax/Util.sv                      | 10 ++++------
 tests/artifact/Artifact.sv                      |  2 +-
 5 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/Function.sv b/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/Function.sv
index d6b08c1..62bc8f0 100644
--- a/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/Function.sv
+++ b/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/Function.sv
@@ -1,6 +1,5 @@
grammar edu:umn:cs:melt:exts:ableC:diff:abstractsyntax;

import core:monad;
import edu:umn:cs:melt:ableC:abstractsyntax:host;
import silver:langutil;
import silver:langutil:pp;
diff --git a/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/SSANames.sv b/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/SSANames.sv
index 3ea0142..0fc56cc 100644
--- a/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/SSANames.sv
+++ b/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/SSANames.sv
@@ -1,7 +1,7 @@
grammar edu:umn:cs:melt:exts:ableC:diff:abstractsyntax;

import edu:umn:cs:melt:ableC:abstractsyntax:host;
import silver:util:raw:treeset as set;
import silver:util:treeset as set;

synthesized attribute names::set:Set<Name>;
inherited attribute namesIn::set:Set<Name>;
diff --git a/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/ToSSA.sv b/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/ToSSA.sv
index 7a9ae03..7e9769d 100644
--- a/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/ToSSA.sv
+++ b/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/ToSSA.sv
@@ -1,6 +1,5 @@
grammar edu:umn:cs:melt:exts:ableC:diff:abstractsyntax;

import core:monad;
import edu:umn:cs:melt:ableC:abstractsyntax:env only sourceLocation;
import edu:umn:cs:melt:ableC:abstractsyntax:host;
import silver:langutil;
@@ -61,7 +60,7 @@ State<SSABuilder Unit> ::= stmt::SSAStmt
function binop
State<SSABuilder SSAArg> ::= binop::(SSAStmt ::= SSAVar SSAArg SSAArg)  ty::Type  lhs::Decorated Expr  rhs::Decorated Expr
{
  return do(bindState, returnState) {
  return do {
    lhsArg::SSAArg <- lhs.toSSA;
    rhsArg::SSAArg <- rhs.toSSA;
    out::SSAVar <- allocVar(ty);
@@ -81,7 +80,7 @@ State<SSABuilder Integer> ::=
function splitBlock
State<SSABuilder Unit> ::= exit::SSAExit
{
  return do(bindState, returnState) {
  return do {
    next::Integer <- preallocBlock();
    finishBlock(exit, next);
  };
@@ -138,7 +137,7 @@ aspect production ifStmt
top::Stmt ::= c::Expr  t::Stmt  e::Stmt
{
  top.toSSAErrors = c.toSSAErrors ++ t.toSSAErrors ++ e.toSSAErrors;
  top.toSSA = do(bindState, returnState) {
  top.toSSA = do {
    cArg::SSAArg <- c.toSSA;
    thenBlock::Integer <- preallocBlock();
    elseBlock::Integer <- preallocBlock();
@@ -157,7 +156,7 @@ aspect production ifStmtNoElse
top::Stmt ::= c::Expr  t::Stmt
{
  top.toSSAErrors = c.toSSAErrors ++ t.toSSAErrors;
  top.toSSA = do(bindState, returnState) {
  top.toSSA = do {
    cArg::SSAArg <- c.toSSA;
    thenBlock::Integer <- preallocBlock();
    endBlock::Integer <- preallocBlock();
@@ -173,7 +172,7 @@ aspect production returnStmt
top::Stmt ::= e::MaybeExpr
{
  top.toSSAErrors = e.toSSAErrors;
  top.toSSA = do(bindState, returnState) {
  top.toSSA = do {
    ret::Maybe<SSAArg> <- e.toSSA;
    splitBlock(ssaRet(ret));
  };
@@ -188,7 +187,7 @@ aspect production consExpr
top::Exprs ::= h::Expr  t::Exprs
{
  top.toSSAErrors = h.toSSAErrors ++ t.toSSAErrors;
  top.toSSA = do(bindState, returnState) {
  top.toSSA = do {
    hArg::SSAArg <- h.toSSA;
    tArgs::SSAArgs <- t.toSSA;
    return consSSAArg(hArg, tArgs);
@@ -218,7 +217,7 @@ aspect production justExpr
top::MaybeExpr ::= e::Expr
{
  top.toSSAErrors = e.toSSAErrors;
  top.toSSA = do(bindState, returnState) {
  top.toSSA = do {
    var::SSAArg <- e.toSSA;
    return just(var);
  };
@@ -309,7 +308,7 @@ aspect production directCallExpr
top::Expr ::= f::Name  a::Exprs
{
  top.toSSAErrors = a.toSSAErrors;
  top.toSSA = do(bindState, returnState) {
  top.toSSA = do {
    aArgs::SSAArgs <- a.toSSA;
    out::SSAVar <- allocVar(top.typerep);
    appendStmt(ssaCall(out, f, aArgs));
diff --git a/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/Util.sv b/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/Util.sv
index 1eb9cbd..3a888f4 100644
--- a/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/Util.sv
+++ b/grammars/edu.umn.cs.melt.exts.ableC.diff/abstractsyntax/Util.sv
@@ -1,7 +1,5 @@
grammar edu:umn:cs:melt:exts:ableC:diff:abstractsyntax;

import core:monad;

-- TODO: Upstream these, etc.

function enumerate
@@ -24,7 +22,7 @@ State<s [b]> ::= f::(State<s b> ::= a) xs::[a]
  return case xs of
  | [] -> returnState([])
  | h::t ->
      do(bindState, returnState) {
      do {
        hVal::b <- f(h);
        tVal::[b] <- mapMState(f, t);
        return (hVal::tVal);
@@ -37,16 +35,16 @@ State<s Unit> ::= f::(State<s Unit> ::= a) xs::[a]
{
  return case xs of
  | [] -> returnState(unit())
  | h::t -> do(bindState, returnState) { f(h); mapM_State(f, t); }
  | h::t -> do { f(h); mapM_State(f, t); }
  end;
}

function state
State<s a> ::= f::(Pair<a s> ::= s)
{
  return do(bindState, returnState) {
  return do {
    old::s <- getState();
    p::Pair<a s> = f(old);
    let p::Pair<a s> = f(old);
    setState(p.snd);
    return p.fst;
  };
diff --git a/tests/artifact/Artifact.sv b/tests/artifact/Artifact.sv
index 4f0334c..134d19b 100644
--- a/tests/artifact/Artifact.sv
+++ b/tests/artifact/Artifact.sv
@@ -17,7 +17,7 @@ parser extendedParser :: cst:Root {
} 

function main
IOVal<Integer> ::= args::[String] io_in::IO
IOVal<Integer> ::= args::[String] io_in::IOToken
{
  return driver(args, io_in, extendedParser);
}
-- 
2.34.2