kaby76 / AntlrExamples

Some examples of parsing with Antlr
15 stars 7 forks source link

New Parser for Shell #4

Open Heidernlee opened 2 years ago

Heidernlee commented 2 years ago

Hi, Do you have an Antlr4 parser/lexer for Linux Shell ? KShell is the best.

BTW, thanks for providing PL1 Parser 2 years ago, It's very very helpful.

kaby76 commented 2 years ago

Sorry, I don't. There was an issue opened in github.com/antlr/grammars-v4 just recently to add Bash, but not for Korn Shell (which used to be my favorite shell actually years ago!). The only other repository of grammars is "Grammar Zoo" https://slebok.github.io/zoo/ but the author didn't collect any shell grammars. You might want to add an issue for Korn Shell to the grammars-v4 repo so we can track it. --Ken

On 2/10/2022 4:18 AM, Heidernlee wrote:

Hi, Do you have an Antlr4 parser/lexer for Linux Shell ? KShell is the best.

BTW, thanks for providing PL1 Parser 2 years ago, It's very very helpful.

— Reply to this email directly, view it on GitHub https://github.com/kaby76/AntlrExamples/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW4UC4DN3U27QD7RCCJE7TU2N7EVANCNFSM5OAB7GGA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

Heidernlee commented 2 years ago

@kaby76 Thanks for your response. Does Antlr/grammars-v4 added G4 for Bash Shell ? Couldn't find it.... could you please offer me any links ? Maybe I have to try to parse KShell with BShell Parser...

kaby76 commented 2 years ago

The issue I mentioned was https://github.com/antlr/grammars-v4/issues/1403 . There is a 7000-line Yacc grammar for Bash mentioned in the discussion https://github.com/bminor/bash/blob/master/parse.y but no one has ported it to Antlr because of the numerous C actions. --Ken

On 2/10/2022 9:24 PM, Heidernlee wrote:

@kaby76 https://github.com/kaby76 Thanks for your response. Does Antlr/grammars-v4 added G4 for Bash Shell ? Couldn't find it.... could you please offer me any links ? Maybe I have to try to parse KShell with BShell...

— Reply to this email directly, view it on GitHub https://github.com/kaby76/AntlrExamples/issues/4#issuecomment-1035777763, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW4UC3XRTLGFMXIGHY7ZM3U2RXMXANCNFSM5OAB7GGA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

Heidernlee commented 2 years ago

@kaby76 Seems this issue from Grammar-v4 is just a new-grammar request for Shell.

I also request Antlr4 Parser here : https://github.com/groundwater/gentoo-libbash/issues/1

Thanks again ^^