Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
1c5aa7e
Change Fujitsu test file structure
Process-ing Apr 23, 2026
c1c1a75
Add new Fujitsu test
Process-ing Apr 23, 2026
f3cb6ed
Add no_program_stmt.f90
Process-ing Apr 23, 2026
9adcbd3
Add support for program units with no program statements
Process-ing Apr 23, 2026
dfee8bc
Add expected output for Fujitsu file
Process-ing Apr 23, 2026
44316cb
Add tests for negate
Process-ing Apr 23, 2026
71f6128
Implement unary operator
Process-ing Apr 23, 2026
0fc37d3
Add missing JSON file
Process-ing Apr 23, 2026
2bf9740
Regenerate dump
Process-ing Apr 23, 2026
a0d4674
Add support for negations
Process-ing Apr 23, 2026
ceed029
Fix negation test
Process-ing Apr 23, 2026
a0b516d
Modify kind selector tests
Process-ing Apr 23, 2026
9995a10
Add kind selector to real declaration
Process-ing Apr 23, 2026
ec089fd
Regenerate dumps
Process-ing Apr 23, 2026
a62236f
Regenerate dumps
Process-ing Apr 23, 2026
8d0fcb8
Add kind information to real declaration
Process-ing Apr 23, 2026
aadb0c5
Add unary operator tests
Process-ing Apr 24, 2026
a0b5d19
Add support for more unary operators
Process-ing Apr 24, 2026
2102360
Fix support for NOT operator
Process-ing Apr 24, 2026
84ca3f6
Add new Fujitsu test case
Process-ing Apr 24, 2026
15158db
Fix new Fujitsu test source files
Process-ing Apr 24, 2026
8639197
Fix new Fujitsu test source files
Process-ing Apr 24, 2026
ff93b11
Add a new Fujitsu test case
Process-ing Apr 24, 2026
aaa4c5c
Add a new Fujitsu test case
Process-ing Apr 24, 2026
9c1033b
Add a new Fujitsu test case
Process-ing Apr 24, 2026
940a2c6
Fix integer literals with kind param
Process-ing Apr 24, 2026
362e3d9
Add one more Fujitsu test
Process-ing Apr 29, 2026
d851293
Change type and array type declarations to be considered as keywords
Process-ing Apr 29, 2026
af7b4f9
Add new Fujitsu test case
Process-ing Apr 29, 2026
35438f6
Add a missing map entry
Onso37 May 7, 2026
a747553
Add support for impled array shapes
Onso37 May 7, 2026
737d2be
Add goto statement
Onso37 May 7, 2026
d620484
Add CommonStmt node
Onso37 May 7, 2026
3109ecc
Add CommonStmt processing
Onso37 May 7, 2026
426ff35
Add support for external statement
Onso37 May 7, 2026
24724be
Add support for return statement and fix a bug in array spec processing
Onso37 May 7, 2026
80ddc37
Add partial support for data statement
Onso37 May 7, 2026
ddc5c99
Add partial support for stop statement
Onso37 May 7, 2026
1774be5
Add support for functions
Onso37 May 7, 2026
0d6d21e
Simplify function args
Onso37 May 7, 2026
fe8c048
very hacky solution for format statement
Onso37 May 7, 2026
1184289
Make conditional constructs have executable blocks
Onso37 May 7, 2026
2194ee6
Add goto tests
Process-ing May 7, 2026
68cb1df
Add goto AST node
Process-ing May 7, 2026
d31c752
Process goto statements
Process-ing May 7, 2026
423496d
Delete GotoStmt
Onso37 May 8, 2026
6afa656
Merge branch 'staging' into feature/fujitsu-support
Onso37 May 8, 2026
bff323e
Add missing "inheritance" calls in statement processors
Onso37 May 8, 2026
9b56b0a
Add hacky support for open/close statements
Onso37 May 8, 2026
a10dc8b
Update some expected outputs
Onso37 May 8, 2026
df28340
Merge branch 'feature/fujitsu-support' into cg-nodes
Onso37 May 8, 2026
340af2a
Fix some tests
Onso37 May 8, 2026
1392683
Add support for power operation
Onso37 May 8, 2026
c9206da
Update weaver json
Onso37 May 8, 2026
62eea96
Update Joinpoints.ts
Onso37 May 8, 2026
8ae8a49
Add some spaces
Onso37 May 8, 2026
0558e61
Add one change from Sergei's branch
Onso37 May 14, 2026
6edf4cf
Update Joinpoints.ts
Onso37 May 14, 2026
975fe47
Add new Fujitsu test case
Process-ing May 28, 2026
02c4309
Add tests for data statemet
Process-ing May 28, 2026
7d978e0
Add nodes for data statements
Process-ing Jun 4, 2026
a04f207
Add processing for data statements
Process-ing Jun 4, 2026
8b22500
Add code generation for data statements
Process-ing Jun 4, 2026
ffeea15
Fix Fujitsu test case expected
Process-ing Jun 4, 2026
2bdc755
Add new subscript nodes
Process-ing Jun 4, 2026
fc1fb42
Change ArraySubscriptExpr to use new SectionSubscript
Process-ing Jun 4, 2026
04e4ffe
Add subscript triplet tests
Process-ing Jun 4, 2026
de33445
Regenerate dumps
Process-ing Jun 4, 2026
b114854
Add processing of normal subscripts
Process-ing Jun 5, 2026
3117823
Fix normal array elements
Process-ing Jun 5, 2026
97d828b
Fix subscript triplet structure
Process-ing Jun 5, 2026
b4e14fc
Add subscript triplet processing
Process-ing Jun 5, 2026
8f0db06
Add subscript triplet code generation
Process-ing Jun 5, 2026
b50912c
Add one more Fujitsu test case
Process-ing Jun 5, 2026
99abe1c
Add one more Fujitsu test case
Process-ing Jun 5, 2026
a116840
Add scope to DataRef
Process-ing Jun 5, 2026
4fcf18f
Add scoping information to variables
Process-ing Jun 5, 2026
e8bfdff
Fix processing for data references without scoping info
Process-ing Jun 5, 2026
0d5d155
Improve scope identification
Process-ing Jun 5, 2026
4de2802
Add nodes for common statement
Process-ing Jun 18, 2026
06afbfb
Add common statement test
Process-ing Jun 18, 2026
ae5a4f9
Fix AST common statement structure
Process-ing Jun 18, 2026
266e0fc
Fix common statement test
Process-ing Jun 25, 2026
8ae57f9
Regenerate dumps
Process-ing Jun 25, 2026
1b195bc
Add common statement processing
Process-ing Jun 25, 2026
0d9405a
Add code generation for common statement
Process-ing Jun 25, 2026
cdc8307
Fix function declarations without parameters
Process-ing Jun 25, 2026
6d0edb1
Add kind to logical type declarations
Process-ing Jun 25, 2026
486beb5
Fix casing on call statement
Process-ing Jun 25, 2026
90cb6a6
Fix Fujitsu test case 0000_0033
Process-ing Jun 25, 2026
096a99d
Update script, apply some fixes and update LLVM IR normalization rules
Process-ing Jun 30, 2026
4e8d911
Add script output to .gitignore
Process-ing Jun 30, 2026
f98db29
Output also original LLVM IR
Process-ing Jun 30, 2026
6d3e73c
Fix script not detecting valid Fortran files
Process-ing Jun 30, 2026
65c3610
Merge pull request #52 from specs-feup/feature/variable-context
joaobispo Aug 3, 2026
0f98bad
Commit to trigger workflow
joaobispo Aug 3, 2026
cbd1319
Merge remote-tracking branch 'origin/staging' into cg-nodes
Onso37 Aug 3, 2026
fce4078
Update expected test result
Onso37 Aug 3, 2026
b4ef7f9
Update weaver files
Onso37 Aug 3, 2026
825a7d9
Changes workflow to specifically use windows-2022
joaobispo Aug 3, 2026
c820288
Merge pull request #54 from specs-feup/feature/fujitsu-support
joaobispo Aug 3, 2026
ed21f1f
Sets Windows version of the workflow to 2022
joaobispo Aug 3, 2026
248420d
Merge remote-tracking branch 'origin/staging' into cg-nodes
Onso37 Aug 3, 2026
33cf77c
Remove duplicate keywords
Onso37 Aug 3, 2026
948a9d9
Remove duplicate processing methods
Onso37 Aug 3, 2026
417d749
Remove duplicate map entries
Onso37 Aug 3, 2026
e3647a9
Remove another duplicate map entry
Onso37 Aug 3, 2026
ec0a221
Merge pull request #50 from specs-feup/cg-nodes
joaobispo Aug 3, 2026
221ff53
Create comment statement node
Process-ing Jul 2, 2026
35a75f4
Create stub for JSON comment processing
Process-ing Jul 2, 2026
b945514
Refactor execution statement output logic
Process-ing Jul 3, 2026
cb9e233
Refactor statements again and try to process comments
Process-ing Jul 6, 2026
8ce727e
Improve AST comment representation
Process-ing Jul 6, 2026
9d102fe
Refactor AST comment representation and processing
Process-ing Jul 6, 2026
849df00
Fix tests with comments
Process-ing Jul 7, 2026
4566a19
Refactor main program node
Process-ing Jul 7, 2026
4fbfa09
Fix weaver
Process-ing Jul 7, 2026
bc9576e
Add null comment check and appropriate warning in Stmt node
Process-ing Jul 7, 2026
4d735b5
Refactor do loop AST representation
Process-ing Jul 7, 2026
bcf3877
Refactor subroutine AST representation
Process-ing Jul 7, 2026
dc5f798
Add tests for comments
Process-ing Jul 7, 2026
6235bf4
Regenerate dump for comment test
Process-ing Jul 7, 2026
8c7369c
Add support for leading comments
Process-ing Jul 7, 2026
c66e4f1
Add support for program final comments
Process-ing Jul 7, 2026
579a842
Update comment test
Process-ing Jul 7, 2026
1504f15
Regenerate dumps
Process-ing Jul 7, 2026
d4228ca
Fix child key in NamedConstantDef processor
Process-ing Jul 8, 2026
b44a695
Improve comments test
Process-ing Jul 8, 2026
251c0d9
Fix structure creation in node factory
Process-ing Jul 8, 2026
6a60dc6
Fix weaver node association
Process-ing Jul 8, 2026
d99674e
Complete weaver fix
Process-ing Jul 8, 2026
b2b0a3a
Updates repository name of push-mirror
joaobispo Aug 4, 2026
7f0673c
Fix statements not compiling
Process-ing Aug 4, 2026
5dcc7d6
Hotfix format statement not working
Process-ing Aug 4, 2026
f2b7304
Fix AST tests
Process-ing Aug 4, 2026
12436fe
Fix Fortran-JS tests
Process-ing Aug 4, 2026
ce3672d
Merge pull request #55 from specs-feup/feature/comment-dumping
joaobispo Aug 4, 2026
4209280
Merge branch 'staging' of github.com:specs-feup/fortran-transpiler in…
joaobispo Aug 4, 2026
e8604e9
Merge pull request #56 from specs-feup/fix/update-push-mirror
joaobispo Aug 4, 2026
6943ec6
Updates Fortran-JS to version 22.1.0
joaobispo Aug 4, 2026
3b715bb
Merge remote-tracking branch 'origin/staging' into fix/repair-transfo…
lm-sousa Aug 4, 2026
e62cadf
fix: repair loop transformation legality
lm-sousa Aug 4, 2026
48cff8e
test: cover structural loop pair identity
lm-sousa Aug 4, 2026
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
2 changes: 1 addition & 1 deletion .github/workflows/mirror-to-gitlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:


- name: Add GitLab remote (SSH)
run: git remote add gitlab ssh://git@git.dare.megware.com:2221/compilers/fortran-transpiler.git
run: git remote add gitlab ssh://git@git.dare.megware.com:2221/compilers/metafor.git

# Push only the public namespaces (no refs/remotes/*)
- name: Push branches
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ jobs:
matrix:
#node-version: ['latest', '22.x', '20.x']
node-version: ['22.x', '20.x']
# node-gyp not working on the lastest windows (2025), needs to be updated
os: [ubuntu-latest, windows-2022, macos-latest]

runs-on: ${{ matrix.os }}
Expand Down
6 changes: 6 additions & 0 deletions Fortran-JS/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,9 @@ dist

# TernJS port file
.tern-port

# Python cache files
__pycache__/

# Fujitsu script results
metafor_fujitsu_results/
9 changes: 6 additions & 3 deletions Fortran-JS/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ import tsdoc from "eslint-plugin-tsdoc";
import jest from "eslint-plugin-jest";
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";

const tsconfigRootDir = dirname(fileURLToPath(import.meta.url));

export default [
js.configs.recommended,
eslintConfigPrettier,
...typescriptEslint.configs.recommended,
{
ignores: ["**/*.d.ts", "**/*.config.js"],
ignores: ["api/**", "code/**", "**/*.d.ts", "**/*.config.js"],
},
{
plugins: {
Expand All @@ -18,13 +22,12 @@ export default [
},

languageOptions: {
tsconfigRootDir: __dirname,

parser: typescriptEslint.parser,
ecmaVersion: 5,
sourceType: "script",

parserOptions: {
tsconfigRootDir,
project: ["./*/tsconfig.json", "./tsconfig.*.json"],
},
},
Expand Down
50 changes: 34 additions & 16 deletions Fortran-JS/metafor_fujitsu_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def __init__(self, args: argparse.Namespace) -> None:
self.noop_script_path.write_text(DEFAULT_NOOP_SCRIPT, encoding="utf-8")

def discover_files(self) -> list[Path]:
files = sorted(self.fortran_root.rglob("*.f90"))
files = sorted(set(self.fortran_root.rglob("*.f90")) | set(self.fortran_root.rglob("*.f")))
if self.args.limit:
files = files[: self.args.limit]
return files
Expand All @@ -146,7 +146,7 @@ def run(self) -> int:

files = self.discover_files()
if not files:
raise PipelineError(f"No .f90 files found under {self.fortran_root}")
raise PipelineError(f"No .f90 or .f files found under {self.fortran_root}")

log(f"Discovered {len(files)} Fortran files")

Expand Down Expand Up @@ -254,7 +254,7 @@ def _stage3(self, path: Path) -> None:
res = self.results[rel]
work_dir = self._stage_work_dir(rel, "stage3")
work_dir.mkdir(parents=True, exist_ok=True)
cmd = self._metafor_command(path)
cmd = self._metafor_command(path, work_dir)
cr = self._run_command(cmd, cwd=work_dir, log_prefix=f"{safe_name(rel)}__stage3")
res.stage3_elapsed_s = cr.elapsed_s
if cr.returncode != 0:
Expand Down Expand Up @@ -289,7 +289,7 @@ def _stage41(self, path: Path) -> None:
stage3_output = Path(res.stage3_output_file).resolve()
work_dir = self._stage_work_dir(rel, "stage41")
work_dir.mkdir(parents=True, exist_ok=True)
cmd = self._metafor_command(stage3_output)
cmd = self._metafor_command(stage3_output, work_dir)
cr = self._run_command(cmd, cwd=work_dir, log_prefix=f"{safe_name(rel)}__stage41")
res.stage41_elapsed_s = cr.elapsed_s
if cr.returncode != 0:
Expand Down Expand Up @@ -334,10 +334,16 @@ def _stage42(self, path: Path) -> None:
self._flang_ir_command(path, original_ir),
log_prefix=f"{safe_name(rel)}__stage42_original",
)
if cr1.returncode == 0 and (not original_ir.exists() or original_ir.stat().st_size == 0):
original_ir.write_text(cr1.stdout, encoding="utf-8")

cr2 = self._run_command(
self._flang_ir_command(stage3_output, regenerated_ir),
log_prefix=f"{safe_name(rel)}__stage42_regenerated",
)
if cr2.returncode == 0 and (not regenerated_ir.exists() or regenerated_ir.stat().st_size == 0):
regenerated_ir.write_text(cr2.stdout, encoding="utf-8")

res.stage42_elapsed_s = cr1.elapsed_s + cr2.elapsed_s
if cr1.returncode != 0 or cr2.returncode != 0:
problems = []
Expand All @@ -352,7 +358,18 @@ def _stage42(self, path: Path) -> None:
res.stage42_original_ir = str(original_ir)
res.stage42_regenerated_ir = str(regenerated_ir)

same = self._normalized_ir_equal(original_ir, regenerated_ir)
original_norm = dest / "original.normalized.ll"
regenerated_norm = dest / "regenerated.normalized.ll"
original_norm.write_text(
normalize_llvm_ir(original_ir.read_text(encoding="utf-8", errors="replace")),
encoding="utf-8",
)
regenerated_norm.write_text(
normalize_llvm_ir(regenerated_ir.read_text(encoding="utf-8", errors="replace")),
encoding="utf-8",
)

same = files_are_identical(original_norm, regenerated_norm)
res.stage42_ok = same
res.stage42_note = "Normalized LLVM IR match" if same else "Normalized LLVM IR mismatch"

Expand Down Expand Up @@ -469,14 +486,16 @@ def _write_command_log(self, prefix: str, result: CommandResult) -> None:
def _stage_work_dir(self, relative_file: str, stage_name: str) -> Path:
return self.work_root / safe_name(relative_file) / stage_name

def _metafor_command(self, source_file: Path) -> list[str]:
def _metafor_command(self, source_file: Path, output_dir: Path) -> list[str]:
return [
self.args.npx,
self.args.metafor_package,
"classic",
str(self.noop_script_path.resolve()),
"-p",
str(source_file.resolve()),
"-o",
str(output_dir),
]

def _flang_ir_command(self, source_file: Path, output_file: Path) -> list[str]:
Expand Down Expand Up @@ -507,11 +526,6 @@ def _locate_generated_file(self, woven_code: Path, source_file: Path) -> Optiona
return all_f90[0]
return None

def _normalized_ir_equal(self, a_path: Path, b_path: Path) -> bool:
a = normalize_llvm_ir(a_path.read_text(encoding="utf-8", errors="replace"))
b = normalize_llvm_ir(b_path.read_text(encoding="utf-8", errors="replace"))
return a == b

def _write_outputs(self, summary: Optional[dict] = None) -> None:
results_csv = self.output_dir / "results.csv"
summary_json = self.output_dir / "summary.json"
Expand Down Expand Up @@ -787,9 +801,11 @@ def write_csv(path: Path, rows: list[dict]) -> None:
LLVM_IR_DROP_LINE_PATTERNS = [
re.compile(r"^; ModuleID = "),
re.compile(r'^source_filename = '),
re.compile(r"^!llvm\\.(module\\.flags|ident) = "),
re.compile(r"^!\\d+ = "),
re.compile(r"^attributes #\\d+ = "),
re.compile(r"^!llvm\.(module\.flags|ident) = "),
re.compile(r"^!\d+ = "),
re.compile(r"^attributes #\d+ = "),
re.compile(r'^[$@]_QQclX[0-9a-fA-F]+\s*='),
re.compile(r'^[$@]_QQclX<SRC>\s*='),
]


Expand All @@ -801,6 +817,8 @@ def write_csv(path: Path, rows: list[dict]) -> None:
(re.compile(r",? !alias.scope ![0-9]+"), ""),
(re.compile(r",? !noalias ![0-9]+"), ""),
(re.compile(r",? !llvm.loop ![0-9]+"), ""),
(re.compile(r"(_QQclX)[0-9a-fA-F]+"), r"\1<SRC>"),
(re.compile(r"(@_QQclX<SRC>,\s*i32\s+)\d+"), r"\1<LINE>"),
]


Expand All @@ -827,7 +845,7 @@ def build_arg_parser() -> argparse.ArgumentParser:
default="metafor_fujitsu_results",
help="Directory where CSV/report/logs/artifacts will be written",
)
p.add_argument("--flang", default="flang-20", help="flang executable")
p.add_argument("--flang", default="flang-22", help="flang executable")
p.add_argument(
"--dump-ast-plugin",
default="./build/DumpASTPlugin.so",
Expand All @@ -846,7 +864,7 @@ def build_arg_parser() -> argparse.ArgumentParser:
)
p.add_argument("--jobs", type=int, default=max(1, (os.cpu_count() or 2) // 2), help="Parallel workers")
p.add_argument("--timeout", type=int, default=120, help="Per-command timeout in seconds")
p.add_argument("--limit", type=int, default=0, help="Optional cap on number of .f90 files to process")
p.add_argument("--limit", type=int, default=0, help="Optional cap on number of Fortran files to process")
p.add_argument("--node-path", default="", help="Optional NODE_PATH value")
return p

Expand Down
2 changes: 1 addition & 1 deletion Fortran-JS/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@specs-feup/metafor",
"version": "22.0.0",
"version": "22.1.0",
"description": "A Fortran source-to-source compiler written in Typescript",
"type": "module",
"files": [
Expand Down
Loading
Loading