Skip to content
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

"Step by Step" Build programs like Legos manuals #17

Open
grantjenks opened this issue Oct 16, 2018 · 0 comments
Open

"Step by Step" Build programs like Legos manuals #17

grantjenks opened this issue Oct 16, 2018 · 0 comments

Comments

@grantjenks
Copy link
Owner

  • Product: Transform program into a set of pages of images of HTML Diffs which edit or construct a program.
  • Study Lego manuals and learn how to do it!
  • Publish these as "book manuals" and market to parents who want to teach their kids how to program.

Tooling

See step_by_step repo for an initial implementation.

  • Python's HTMLDiff - generate html diffs
  • PhantomJS - screen capture for html
  • Pygments - syntax highlighter
  • autopep8 - source code formatter

Methods

Annotated construction

Annotate with comments:

# >>> 1
def count(iterable):
    return sum(1 for val in iterable)
# <<<
# >>> 2
total = count(values)
# <<<

Automatic construction

def count(iterable):     # 1 Function start.
    total = 0            # 2 Block.
    for val in iterable: # 3 Loop start.
        total += 1       # 4 Block.
    return total         # 5 Function end.
  • Break at blocks/block headers.
  • Maybe this should allow for annotated diffs.

Edits

# >>> 6v1
foreground = (0, 0, 0)
# <<<
# >>> 6v2
foreground = (255, 0, 0)
# <<<
  • Tag: chunk name, diff name, next diff name
  • If chunk name repeats then it is the application of a diff?
  • Diffs should be ordered in a linked list for easy insertion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant