Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
branches:
- main
- staging
- multi-weaver

push:
branches:
Expand Down Expand Up @@ -178,7 +179,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: ['22.x']
node-version: ['25.x', '24.x']
os: [ubuntu-26.04, windows-2022, macos-latest]

runs-on: ${{ matrix.os }}
Expand Down
115 changes: 1 addition & 114 deletions Fortran-JS/.gitignore
Original file line number Diff line number Diff line change
@@ -1,122 +1,9 @@
##### User-added #####
woven_code/
/api
/code
node_modules/
package-lock.json
java-binaries
fortran_sources

# Extensions
ltex.dictionary.*
######################

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Python cache files
__pycache__/

# Fujitsu script results
metafor_fujitsu_results/
10 changes: 9 additions & 1 deletion Fortran-JS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@

A Fortran source-to-source compiler running on top of Node.js.

Current version only works on Node 20 and 22.
## Development

Build the Java weaver first — `npm run build-interfaces` needs the `FortranWeaver.json` specification generated by the WeaverGen2 Gradle task:

```bash
gradle -p FortranWeaver installDist
```

The `installDist` task synchronizes the complete FortranWeaver distribution into `./Fortran-JS/java-binaries`. The generated directory is refreshed automatically, including when `installDist` is invoked directly, so do not copy or edit its contents manually. Local `npm pack` and `npm publish` also validate that `java-binaries` is a real, populated directory before creating a package.

Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import JavaTypes, {JavaClasses} from "@specs-feup/lara/api/lara/util/JavaTypes.js";
import JavaTypes, {
type JavaClasses,
} from "@specs-feup/lara/api/lara/util/JavaTypes.ts";

// eslint-disable-next-line @typescript-eslint/no-namespace
// oxlint-disable-next-line typescript/no-namespace
export namespace FortranJavaClasses {
/* eslint-disable @typescript-eslint/no-empty-object-type */
/* oxlint-disable typescript/no-empty-object-type */
export interface AstFactory extends JavaClasses.JavaClass {}
/* eslint-enable @typescript-eslint/no-empty-object-type */
/* oxlint-enable typescript/no-empty-object-type */
}

export default class FortranJavaTypes {
Expand All @@ -13,4 +15,4 @@ export default class FortranJavaTypes {
"pt.up.fe.specs.fortran.weaver.importable.AstFactory"
) as FortranJavaClasses.AstFactory;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,100 +1,111 @@
import * as Joinpoints from "./Joinpoints.js";
import {unwrapJoinPoint, wrapJoinPoint} from "@specs-feup/lara/api/LaraJoinPoint.js";
import FortranJavaTypes from "./FortranJavaTypes.js";
import {flattenArgsArray} from "@specs-feup/lara/api/lara/core/LaraCore.js";
import * as Joinpoints from "./Joinpoints.ts";
import { unwrapJoinPoint, wrapJoinPoint } from "@specs-feup/lara/api/LaraJoinPoint.ts";
import Weaver from "@specs-feup/lara/api/weaver/Weaver.ts";
import FortranJavaTypes from "./FortranJavaTypes.ts";
import { flattenArgsArray } from "@specs-feup/lara/api/lara/core/LaraCore.ts";

export default class FortranJoinPoints {
static ompLoopConstruct(loop: Joinpoints.DoStatement, clauses: Joinpoints.OmpClause[]): Joinpoints.OmpLoopConstruct {
return wrapJoinPoint(FortranJavaTypes.AstFactory.ompLoopConstruct(
Weaver.getWeaverEngine(),
unwrapJoinPoint(loop),
flattenArgsArray(clauses).map(unwrapJoinPoint)
));
));
}

static emptyOmpLoopConstruct(): Joinpoints.OmpLoopConstruct {
return wrapJoinPoint(FortranJavaTypes.AstFactory.emptyOmpLoopConstruct());
return wrapJoinPoint(FortranJavaTypes.AstFactory.emptyOmpLoopConstruct(Weaver.getWeaverEngine()));
}

static ompPrivateClause(dataRefs: Joinpoints.DataRef[]): Joinpoints.OmpDataSharingClause {
return wrapJoinPoint(FortranJavaTypes.AstFactory.ompPrivateClause(
Weaver.getWeaverEngine(),
flattenArgsArray(dataRefs).map(unwrapJoinPoint)
));
}

static dataRef(name: string): Joinpoints.DataRef {
return wrapJoinPoint(FortranJavaTypes.AstFactory.dataRef(name));
return wrapJoinPoint(FortranJavaTypes.AstFactory.dataRef(Weaver.getWeaverEngine(), name));
}

static useStatement(moduleName: string): Joinpoints.UseStatement {
return wrapJoinPoint(FortranJavaTypes.AstFactory.useStatement(moduleName));
return wrapJoinPoint(FortranJavaTypes.AstFactory.useStatement(Weaver.getWeaverEngine(), moduleName));
}

static ompReductionClause(operator: string, dataRefs: Joinpoints.DataRef[]): Joinpoints.OmpReductionClause {
return wrapJoinPoint(FortranJavaTypes.AstFactory.ompReductionClause(
Weaver.getWeaverEngine(),
operator,
flattenArgsArray(dataRefs).map(unwrapJoinPoint)
));
}

static emptyOmpBlockConstruct(): Joinpoints.OmpBlockConstruct {
return wrapJoinPoint(FortranJavaTypes.AstFactory.emptyOmpBlockConstruct());
return wrapJoinPoint(FortranJavaTypes.AstFactory.emptyOmpBlockConstruct(Weaver.getWeaverEngine()));
}

static execution(stmts: Joinpoints.ExecutableStatement[]): Joinpoints.Execution {
return wrapJoinPoint(FortranJavaTypes.AstFactory.execution(
Weaver.getWeaverEngine(),
flattenArgsArray(stmts).map(unwrapJoinPoint)
));
}

static ompOrderedClause(value: number): Joinpoints.OmpOrderedClause {
return wrapJoinPoint(FortranJavaTypes.AstFactory.ompOrderedClause(value));
return wrapJoinPoint(FortranJavaTypes.AstFactory.ompOrderedClause(Weaver.getWeaverEngine(), value));
}

static intLiteral(value: number): Joinpoints.IntLiteral {
return wrapJoinPoint(FortranJavaTypes.AstFactory.intLiteral(value));
return wrapJoinPoint(FortranJavaTypes.AstFactory.intLiteral(Weaver.getWeaverEngine(), value));
}

static binaryOperatorAdd(lhs: Joinpoints.Expr, rhs: Joinpoints.Expr): Joinpoints.BinaryOperator {
return wrapJoinPoint(FortranJavaTypes.AstFactory.binaryOperatorAdd(
Weaver.getWeaverEngine(),
unwrapJoinPoint(lhs),
unwrapJoinPoint(rhs)
));
}

static binaryOperatorSubtract(lhs: Joinpoints.Expr, rhs: Joinpoints.Expr): Joinpoints.BinaryOperator {
return wrapJoinPoint(FortranJavaTypes.AstFactory.binaryOperatorSubtract(
Weaver.getWeaverEngine(),
unwrapJoinPoint(lhs),
unwrapJoinPoint(rhs)
));
}

static binaryOperatorMultiply(lhs: Joinpoints.Expr, rhs: Joinpoints.Expr): Joinpoints.BinaryOperator {
return wrapJoinPoint(FortranJavaTypes.AstFactory.binaryOperatorMultiply(
Weaver.getWeaverEngine(),
unwrapJoinPoint(lhs),
unwrapJoinPoint(rhs)
));
}

static binaryOperatorDivide(lhs: Joinpoints.Expr, rhs: Joinpoints.Expr): Joinpoints.BinaryOperator {
return wrapJoinPoint(FortranJavaTypes.AstFactory.binaryOperatorDivide(
Weaver.getWeaverEngine(),
unwrapJoinPoint(lhs),
unwrapJoinPoint(rhs)
));
}

static rangeLoopControl(var_: Joinpoints.DataRef, lower: Joinpoints.Expr, upper: Joinpoints.Expr): Joinpoints.RangeLoopControl {
return wrapJoinPoint(FortranJavaTypes.AstFactory.rangeLoopControl(
Weaver.getWeaverEngine(),
unwrapJoinPoint(var_), unwrapJoinPoint(lower), unwrapJoinPoint(upper)
));
}

static doStatement(control: Joinpoints.RangeLoopControl): Joinpoints.DoStatement {
return wrapJoinPoint(FortranJavaTypes.AstFactory.doStatement(unwrapJoinPoint(control)));
return wrapJoinPoint(FortranJavaTypes.AstFactory.doStatement(Weaver.getWeaverEngine(), unwrapJoinPoint(control)));
}

static intrinsicCall(name: string, args: Joinpoints.Expr[]): Joinpoints.Expr {
return wrapJoinPoint(FortranJavaTypes.AstFactory.intrinsicCall(
Weaver.getWeaverEngine(),
name, args.map(unwrapJoinPoint)
));
}
}
}
Loading
Loading