-
-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New functions to detect and parse assignments.
Wrote tests for them, but haven't hooked them up to the main codebase yet. The new _MakeAssignPair function invokes the arithmetic parser where necessary. Wrote a new _AppendMoreEnv function, using the 'prepared' or 'detected' tuple. Also: - Notes on OSH architecture. 'alias' and array location assignment made things less clean.
- Loading branch information
Andy Chu
committed
Sep 15, 2018
1 parent
3812c98
commit ea80189
Showing
11 changed files
with
323 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
Notes on OSH Architecture | ||
------------------------- | ||
|
||
## Where we (unfortunately) must re-parse previously parsed text | ||
|
||
- alias expansion | ||
- Array assignment like `a[x+1]=foo` (because breaking word boundaries like | ||
`a[x + 1]=foo` causes a lot of problems, and I don't see it used.) | ||
|
||
Each of these cases has implications for translation, because we break the | ||
"arena invariant". | ||
|
||
## Parser Lookahead | ||
|
||
- `func() { echo hi; }` vs. | ||
- `func=() # an array` | ||
|
||
## Where the arena invariant is broken | ||
|
||
- Here docs with <<-. The leading tab is lost, because we don't need it for | ||
translation. | ||
|
||
## Where VirtualLineReader is used | ||
|
||
This isn't re-parsing, but it's re-reading. | ||
|
||
- alias expansion | ||
- HereDoc | ||
|
||
## Where parsers are instantiated | ||
|
||
- See `osh/parse_lib.py` and its callers. | ||
|
||
## Where code strings are evaluated | ||
|
||
- source and eval | ||
- trap | ||
- PS1 and PS4 (WordParser is used) | ||
- completion hooks registered by `complete -F ls_complete_func ls` | ||
|
||
## Parse errors at runtime (need line numbers) | ||
|
||
- [ -a -a -a ] | ||
- command line flag usage errors | ||
|
||
## Where unicode is respected | ||
|
||
- ${#s} -- length in code points | ||
- ${s:1:2} -- offsets in code points | ||
- ${x#?} and family (not yet implemented) | ||
|
||
## Parse-time and Runtime Pairs | ||
|
||
- echo -e '\x00\n' and echo $'\x00\n' (shared in OSH) | ||
- test / [ and [[ (shared in OSH) | ||
|
||
### Other Pairs | ||
|
||
- expr and $(( )) (expr not in shell) | ||
- later: find and our own language | ||
|
||
|
||
## Dependencies | ||
|
||
- Optional: readline | ||
|
||
## Borrowed Code | ||
|
||
- All of OPy: | ||
- pgen2 | ||
- compiler2 from stdlib | ||
- byterun | ||
- ASDL front end from CPython (heavily refactored) | ||
- core/tdop.py: Heavily adapted from tinypy | ||
|
||
## Generated Code | ||
|
||
- See `build/dev.sh` | ||
|
Oops, something went wrong.