Yesterday, I reviewed November's Roadmap #3. I'm happy with the progress so far, and I think that this is the point in the project where contributions will accelerate it.
To orient contributors, this post describes what I want work on in the next month or two.
I believe software projects to move faster with automated tests. They should help contributors write code for Oil, and they will help me review code.
As mentioned on the Github page, there are three kinds of tests:
I've published the spec test results as HTML. The very next task will be to publish the unit tests and wild tests the same way.
The test coverage is fairly high, and I want to keep it high. Contributors should be able to make pretty aggressive changes to the source code and rely on the tests to catch breakages.
And you should be able to make enhancements without understanding the whole program, even though it has a simple and comprehensible architecture.
Surprisingly, nobody has complained that almost all the code is in Python. Even though Python made Google successful, I'm used to hearing C++ or Java programmers question its usage.
In fact the opposite is true: I've been asked why it should be ported to C or C++ at all.
A few reasons:
os.fork().So I want to explore the C++ software architecture by threading through a command like this:
$ test -d / && echo 'hello world' hello world
The chain will look roughly like this:
osh.asdl.osh.asdl and oil.asdl will compile to a simpler language specified
in ovm.asdl. I need to write a slice of the OSH-to-OVM compiler, probably
in Python.ovm.asdl trees will be serialized in OHeap format.ovm.asdl.core/id_kind.py (The
Backbone of the Interpreter).Three pieces of relevant C++ code already exist, so hopefully this work will mostly be gluing them together and polishing.
Once that is done, there are still more tasks:
two more tasks:
I wrote a parser for OSH, and a translator from OSH to Oil.
But I still don't have a parser for Oil!
Make a big claim: No Parser Generator or Meta-Language Can Handle the Shell
TODO: Copy points from Hacker News post. lexer modes, lexer hints, pratt parsing, etc.
Same strategy: top-down, lexer modes, etc. two interleaved sublanguages
This is sort of an unknown.
TODO: Possibly include bootstrap.md -- notes about bootstrapping.
Use Python AST module. BUT: I want to preserve my comments. Lossless Syntax Tree for Python? RedBaron?
I might suffice to rewrite all the comments, because they're pretty out of date.
Problems with conversion: I didn't use exceptions?
USEFUL INTERMEDIATE GOAL:
Maybe its own blog post. What should I do with OSH? What are the carrots for adoption?
Parse and runtime error messages. Could that be enough?
Oil will be very compatible at the language level, but I'm not sure about the completion level.
OSH is more like a language platform, with a lossless syntax tree:
Lint tools: warn about unused variables, etc.
Code coverage. For Aboriginal Linux. Minimal Linux. This is kind of educational.
Profiling tools. Take
Debugger. I'm not sure I know how to write a debugger. If you've written one and want to
Most programming languages fail.
If Oil takes longer than expected, or I don't have a lot of contributors, I can polish OSH more.
If people are using OSH, then they will probably contribute.
Also: Oil can serve as an extension language for OSH.
COMBINE THE LANGUAGES.
"source mylib.sh"
"oil-source mylib.oil"
Also function calls:
$[foo(bar,baz)]
$[ escapeHtml(foo, bar) ]
$(( foo(bar,baz) ))
$[ glob('*.py') ]
I don't know how things will play out. We'll see.
It's generally hard to get people to new languages, but converting from OSH to oil is a good start.
If you have feedback, about this plan, leave a comment.
I hope that the automated test enhancements I've described enable pleasant and friction-free contributions.
In theory, I should be able to work on the architecture of the C++ code while others work on the Python code.
The next blog posts will probably point to CONTRIBUTING and TESTING docs that I'll publish in the Git repository.