antlr / grammars-v4

Grammars written for ANTLR v4; expectation that the grammars are free of actions.
MIT License
10.19k stars 3.71k forks source link

PL/I or PL1 Grammars #1752

Open Heidernlee opened 4 years ago

Heidernlee commented 4 years ago

Anyone can provide a PL/1 Grammar? PL/0 seems doesn't work with PL/1.

Heidernlee commented 4 years ago

Thanks for labeling. I was told that PL/I is also very common used on Mainframe-System (Cobol + PL/I).

ghost commented 4 years ago

https://www.cs.vu.nl/grammarware/browsable/os-pli-v2r3/ This document might be useful

Heidernlee commented 4 years ago

@KvanTTT @studentmain Thanks for providing the following site: https://www.cs.vu.nl/grammarware/browsable/os-pli-v2r3/

This Grammar is created in 90's and seems Based on EBNF. Is there any way to Trans EBNF to Antlr4 ? any Tools ?

teverett commented 4 years ago

I've start to port the grammar from the link here https://github.com/teverett/grammars-v4/tree/pl1

PR's are welcome

Heidernlee commented 4 years ago

@teverett Thanks for your response. I'll continue to test this g4 with my PL/I Source Code.

teverett commented 4 years ago

@Heidernlee it's hardly in a testable state yet. Lots of work to do before it can even parse "Hello World".

kaby76 commented 4 years ago

Since PL/1 was the first compiler I worked on out of school, at Intermetrics, 35 years ago, I decided as an exercise today to see if I can use my VS extension for Antlr to import the grammar from http://pl1gcc.sourceforge.net/ then use the transforms to fix the grammar (i.e., remove indirect left recursion, convert string literals for keywords to a sequence of upper and lower case letters). It had some problems, which I'm correcting, but it mostly worked. I now have a parser for PL/1 here: https://github.com/kaby76/AntlrExamples/tree/master/pl1. The grammar at https://www.cs.vu.nl/grammarware/browsable/os-pli-v2r3/ is not in a machine-readable form, and has a warning saying "This grammar is not yet corrected nor completed". For example, it doesn't include lexical considerations, like case and abbreviations for keywords. Further, there's supposed to be a preprocessor for PL/1, which the GNU FE for PL/1 implements. But, it works for several PL/1 files. There's an LSP server for PL/1 for VSCode, but the git repo for it is complete vaporware--no parser--a la IBM.