Jiawen Lin 2026/03/02
A Python program that translates a restricted subset of Shell syntax into Python source code. This public portfolio summary describes the project at a high level; assignment solutions and teaching materials are not included.
Python, regular expressions, Shell syntax, source-to-source translation, command-line processing and handling differences between language semantics.
- Translated variable assignments, output statements, conditionals and loops into Python.
- Used regular-expression tokenisation and variable expansion to handle quoting, positional parameters and arithmetic expressions.
- Distinguished numeric and string comparisons in conditional expressions.
- Mapped external commands and command substitution to Python subprocess operations.
- Used filename-pattern expansion and generated required module imports.
This is a translator for a Shell subset, not a complete POSIX shell implementation. The source review identified edge cases involving unset variables, unmatched filename patterns, while-read loops and redirection. No claim is made that the course autotests all pass or that all Shell semantics are preserved.
用 Python 和正则表达式实现 Shell 语法子集到 Python 的源码转译,涉及变量展开、条件与循环、命令调用及文件名模式处理。该展示页用于说明项目范围和技术实践,不公开课程解答,不声称完整兼容 Shell 或全部测试通过。