Skip to content

How hard would it be to creating a custom parser based on an existing shell language? #1006

Answered by hwittenborn
hwittenborn asked this question in Q&A
Discussion options

You must be logged in to vote

I'm just leaving this here for commentary, but I think this is going to be the approach I'm going to use in my program:

Without going too much into the specifics, I'm going to be restricting the stuff that can happen at a global scope in a file (the file format is going to be for something similar to PKGBUILDs), so I'm probably going to do some quick string-based pre-processing and then just convert things like package { to package() {, and then pass that result into this library. I'm going to have to do some AST parsing for some static analysis anyway, so I'll be able to detect all those use cases just fine.

I think I'm at a pretty confident place on what I need to do, but I'll send a me…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@mvdan
Comment options

@hwittenborn
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by hwittenborn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1005 on May 30, 2023 17:25.