Skip to content

Commit 7b9dc5f

Browse files
msujewmontymxbLotes
committed
Prototype implementation of PL/I
Co-authored-by: Benjamin Wilson <benjamin.wilson@typefox.io> Co-authored-by: Markus Rudolph <markus.rudolph@typefox.io> Signed-off-by: Mark Sujew <mark.sujew@typefox.io>
1 parent 769e52c commit 7b9dc5f

File tree

66 files changed

+13609
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+13609
-5
lines changed

.eslintrc.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": {
5+
"ecmaVersion": 6,
6+
"sourceType": "module"
7+
},
8+
"plugins": [
9+
"@typescript-eslint"
10+
],
11+
"rules": {
12+
}
13+
}

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
name: CI (${{ matrix.os }})
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: [windows-latest, ubuntu-latest]
18+
runs-on: ${{ matrix.os }}
19+
timeout-minutes: 20
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
- name: Install pnpm
24+
uses: pnpm/action-setup@v4
25+
with:
26+
version: 9
27+
- name: Use Node.js
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version: '18'
31+
cache: 'pnpm'
32+
- name: Build
33+
shell: bash
34+
run: |
35+
pnpm install
36+
pnpm build
37+
- name: Test
38+
if: success() || failure()
39+
shell: bash
40+
run: |
41+
pnpm test

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.vscode/*
2+
!.vscode/extensions.json
3+
!.vscode/launch.json
4+
!.vscode/tasks.json
5+
node_modules/
6+
dist/
7+
out/
8+
**/src/generated
9+
**/syntaxes/pli.merged.json
10+
*.tsbuildinfo
11+
*.vsix

.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
auto-install-peers = true
2+
lockfile = true
3+
link-workspace-packages = true

.vscode/extensions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"langium.langium-vscode",
4+
"vitest.explorer"
5+
]
6+
}

.vscode/launch.json

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// A launch configuration that launches the extension inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": [
13+
"--extensionDevelopmentPath=${workspaceFolder}/packages/extension",
14+
"${workspaceFolder}/code_samples"
15+
],
16+
"sourceMaps": true,
17+
"outFiles": [
18+
"${workspaceFolder}/packages/language/out/**/*.js",
19+
"${workspaceFolder}/packages/extension/out/**/*.js"
20+
]
21+
},
22+
{
23+
"name": "Run Web Extension",
24+
"type": "extensionHost",
25+
"debugWebWorkerHost": true,
26+
"request": "launch",
27+
"args": [
28+
"--extensionDevelopmentPath=${workspaceFolder}/packages/extension",
29+
"--extensionDevelopmentKind=web",
30+
"${workspaceFolder}/code_samples"
31+
],
32+
"sourceMaps": true,
33+
"outFiles": [
34+
"${workspaceFolder}/packages/language/out/**/*.js",
35+
"${workspaceFolder}/packages/extension/out/**/*.js"
36+
]
37+
}
38+
{
39+
"name": "Attach to Language Server",
40+
"type": "node",
41+
"port": 6009,
42+
"request": "attach",
43+
"skipFiles": [
44+
"<node_internals>/**"
45+
],
46+
"sourceMaps": true,
47+
"outFiles": [
48+
"${workspaceFolder}/packages/language/out/**/*.js",
49+
"${workspaceFolder}/packages/extension/out/**/*.js",
50+
"${workspaceFolder}/node_modules/langium"
51+
]
52+
},
53+
{
54+
"name": "Vitest: Run All",
55+
"type": "node",
56+
"request": "launch",
57+
"skipFiles": [
58+
"<node_internals>/**",
59+
],
60+
"cwd": "${workspaceFolder}",
61+
"runtimeExecutable": "npx",
62+
"args": [
63+
"vitest",
64+
"run",
65+
"--no-watch"
66+
],
67+
"smartStep": true,
68+
"console": "integratedTerminal"
69+
},
70+
{
71+
"name": "Vitest: Run Selected File",
72+
"type": "node",
73+
"request": "launch",
74+
"autoAttachChildProcesses": true,
75+
"skipFiles": [
76+
"<node_internals>/**"
77+
],
78+
"runtimeExecutable": "npx",
79+
"args": [
80+
"vitest",
81+
"run",
82+
"${relativeFile}"
83+
],
84+
"smartStep": true,
85+
"console": "integratedTerminal"
86+
}
87+
]
88+
}

code_samples/CHART.pli

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*PROCESS X(S),A(S),LINECOUNT(60);
1+
/*PROCESS X(S),A(S),LINECOUNT(60); */
22
/* %M% %I% %D% %T%
33
PUNCH ' IDENTIFY **%M%1(''%M%/%I% %D% %T%'')'
44
PUNCH ' ENTRY PLISTART '
@@ -840,14 +840,14 @@
840840
0 (' I ', CHAR('NAME', 33),
841841
'TYPE DCL USE1 USE2 CALL1 CALL2')
842842
0 (SKIP, A, A, A)
843-
((I, ENTRY(I) DO I = 0 TO ENTRY_TABLE_COUNT))
843+
(I, (ENTRY(I) DO I = 0 TO ENTRY_TABLE_COUNT))
844844
(SKIP, F(4), X(1), A(33), A(8), (5) F(6), X(1), A, X(1), A);
845845
0 PUT SKIP(3) EDIT
846846
('----------- REF TABLE -----------')
847847
(A)
848848
0 (' I ', CHAR('NAME', 33),' CALL_AT COUNT ENTRY# NEXT#')
849849
(SKIP, A, A, A)
850-
0 ((I, REF(I) DO I = 1 TO REFERENCE_TABLE_COUNT))
850+
0 (I, (REF(I) DO I = 1 TO REFERENCE_TABLE_COUNT))
851851
(SKIP, F(4), X(1), A(33), (4) F(8));
852852
0END DUMP;
853853
1/*-------------------------------------------------------------------*/

code_samples/MACROS.pli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*PROCESS MI(':'),NEST,X,AG,A,MAR(2,72,1),GN,NUM,STG;
1+
/*PROCESS MI(':'),NEST,X,AG,A,MAR(2,72,1),GN,NUM,STG; */
22

33
/*** (CHECK): ***/
44

code_samples/PLI0002.pli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
/* DECLARE HOST-VARIABLE */
3939
DCL TIMESTAMP CHAR(26);
40-
DCL BUF1_CLOB SQL TYPE IS CLOB_FILE;
40+
DCL BUF1_CLOB; // SQL TYPE IS CLOB_FILE;
4141
EXEC SQL DECLARE :BUF1_CLOB VARIABLE CCSID EBCDIC;
4242

4343
DCL I FIXED BIN(31);

code_samples/messages/IBM1295IE.pli

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
TEST: PROCEDURE OPTIONS(MAIN) REORDER;
2+
dcl x(-2) fixed bin; //error: IBM1295IE Sole bound specified is less than 1. An upper bound of 1 is assumed.
3+
END TEST;

code_samples/messages/IBM1324IE.pli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
0PACK: PACKAGE EXPORTS(TEST, TEST, TEST); //error: TEST has 3 occurences, needed 1
2+
0END;

code_samples/messages/IBM1388IE.pli

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
0a: proc( x ) options(nodescriptor); //error: The NODESCRIPTOR attribute is invalid when any parameters have the NONCONNECTED attribute.
2+
dcl x(20) fixed bin nonconnected;
3+
0end a;

package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "pl-one-workspace",
3+
"description": "Base workspace package",
4+
"version": "0.0.1",
5+
"type": "module",
6+
"private": true,
7+
"scripts": {
8+
"watch": "tsc -b tsconfig.build.json --watch",
9+
"build": "pnpm langium:generate && tsc -b tsconfig.build.json && pnpm --dir packages/extension build && node ./scripts/merge-tmlanguage.mjs",
10+
"build:clean": "pnpm clean && pnpm build",
11+
"lint": "eslint src --ext ts",
12+
"langium:generate": "pnpm --dir packages/language langium:generate",
13+
"langium:watch": "pnpm --dir packages/language langium:watch",
14+
"test": "vitest"
15+
},
16+
"devDependencies": {
17+
"@types/node": "^18.0.0",
18+
"@typescript-eslint/parser": "~7.13.0",
19+
"@typescript-eslint/eslint-plugin": "~7.13.0",
20+
"eslint": "~8.57.0",
21+
"deepmerge": "^1.5.0",
22+
"langium": "~3.2.0",
23+
"shx": "~0.3.4",
24+
"typescript": "~5.4.5",
25+
"vitest": "^1.6.0"
26+
},
27+
"volta": {
28+
"node": "18.20.3",
29+
"npm": "10.7.0"
30+
}
31+
}

packages/extension/.vscodeignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.vscode/**
2+
.vscode-test/**
3+
src/**

0 commit comments

Comments
 (0)