-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is this alive? #11
Comments
I've done some work on my own bash grammar. I'm game to update that to the level this one is at, plus the additional bash-specific features I've already implemented. |
Hi @piranna. I've started to work on this repo to help @dthree with its cash project. It seems that cash is also stagnating from some months now. If I remember well, @dthree said he got some personal problem that cause him to reduce its OSS commitment. The branch I started from scratch has reached the point, according to me, where it would greatly benefits from integration in another project. I did not loose interest in this project, it's still on my "nice thinks I want to complete sometime" list. So, if you want to pick this for @nfisher: I started the new branch to strictly follow the POSIX standard, I felt it would have been more difficult using your code as a starting point. |
Hi guys. Really sorry I haven't been able to put more time into these things and have admittedly been letting them stagnate. My life took some large turns and I've had very, very little time for OSS. I do hope that changes soon, but don't let me hold you guys up. |
@dthree: no worries, you clearly said that months ago. I hope the large turns are nice ones! |
On the technical side, as fair as i remember I was working on substitutions when I stp coding months ago. That part requires to start modeling an API to interact with the shell, because the parser has to use the shell to invoke commands or do arithmetics or query the alias table. |
@parro-it is that necessary for the parsing process? I see how that's of course necessary for execution, but it seems to me like you could write a parser for that without any sort of semantic execution. |
Do you have it published on npm or just only here on github? Is it in a "stabilized" status so I can be able to work with? How complete is it compared to
@creationix was looking something similar to
Forget about that, just return an AST similar to the one of
I think so, as I've said before |
No, just here, but that's easy to fix...
What exactly do you mean by "stabilized"? I think I could merge the branch into master, publish to npm, but expect bugs, this is never used in production before...
I'm honestly not sure... I try to follow POSIX standard as close as possible, the various kinds of substitutions are the only parts remaining to implement as fair as I remember see this list
The problem is that the result of substitutions could alter the AST the grammar should produce. I have to read the standard again to provide some example...
Nice, I'll comment on that issue... |
@parro-it interesting to know. Let me know when you find the example, I'd be curious to learn 😃 |
The first one I was able to recal is about aliases. Taken from http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html:
This basically means we have to:
For example, if you try this on shell: a 1 2' It should not correctly parse because of unclosed single quote. alias a="echo '" then There are similar issues also with other kind of substitution. |
@parro-it ^ did not know that! Just tried it out, and it works like you suggested (at least for zsh). Cool! So I agree, to correctly parse a shell script, it appears you would actually need to have some semantic information (at least for the aliases). |
That would be good. Are you passing tests?
You are missing argument, command and process substitution to be on par
You are missing the point, you only need to parse the script and generate |
I agree that would be a good thing to have, but left it for a future
|
Ok, I get your point now.
There are 68 passing tests and 3 skipped. I'll proceed with following steps, in order:
|
Cool, keep us informed :-) |
Also if possible document a bit the format of the AST nodes, so I don't need to reverse engineer them. |
This will be a force push because I started |
@dthree can you help me? Maybe you can make me a member of vorpaljs? |
You can use easy-coveralls to add tests coverage support, too. Disclaimer: |
Does it work only with mocha? I'm using AVA |
Probably it would be updated to use |
Ok, it seems it require to use nyc to generate coverage data, because of its AVA multi-process nature. Coverage seems good: 87% but percentage is lowered by grammar.js which has a 74%. I think I'll try to exclude the file from coverage statistics. It would be good to also get grammar rule coverage statistics, but I guess this is not easy to undertand looking at the built js file. |
Badges are actually referring to my own fork, waiting for help by dthree to proper setup travis |
Just published version 0.1.0 on npm.
should return this AST: {
type: 'list',
andOrs: [{
type: 'andOr',
left: [{
type: 'simple_command',
name: 'echo',
suffix: {
type: 'cmd_suffix',
list: [
'world'
]
}
}]
}]
} AST node types takes the same name of POSIX grammar rules that define them. |
It's not on my short-term plans, pull-requests are welcome. I think
Nomenclature is not intuitive ( |
@piranna were you thinking of glfw? |
😈 no, it isn't. The whole POSIX standard is a mess! |
From the tests (don't know about the spec) I would try to improve:
|
If we stick to the spec to have it as reference then we should left them as-is, but at least we should consider the two points I put on the previous message. |
No, I was thinking about |
Spec doesn't dictate how an AST should be built. The advantage is that you easily know |
I have read the grammar spec and now thinks make more sense, since there was several use cases we were not taking in account... Ok, that's fine, but if possible I would use the same nomenclatures and style and case, so instead of |
Sure. I doesn't remember why I don't use an exact match for all nodes... |
Probably due to the use of the |
I use |
Of course! |
@parro-it no worries. The grammar I was writing is also a javascript-based PEG. I wrote it for a transpiler project I started. Here's the source file. It's not quite as far along as js-shell-parse, so I'd have to do a bit of refactoring first for us to be able to use it. Unfortunately, the Ohm parsing framework (the one I've been using) is still lacking important features to be able to comfortably parse bash, so it's far from complete. |
It was several months without news on the project, is there someone still working on this? I have retake
nsh
and would like to complete it with the missing parts on the POSIX standard...The text was updated successfully, but these errors were encountered: