Settings

Theme

Claw Code – A Full Rewrite of Claude Code in Python

github.com

1 points by redbell a month ago · 3 comments

Reader

admin82326 a month ago

Python programmers! Complete the interpreter for me! THIS IS WHAT THE SOURCE CODE LOOKS LIKE: --------------------------------------------------------------------- "ladder - interpreted programming language" "this is a set (S) {1, 2, 3, 4, 5} "" "this is an amount (A) of the set (S) with an interval (I) [0;5) Ai S[i] "" "this is the product (P) of the sum of the "elements of the set (S) and an amount (A) of the set (S) "with an interval (I) I Pi S[i] + A ------------------------------------------------------------ HERE IS A PIECE OF THE INTERPRETER: ------------------------------------------------------------ import sys

SET = []; INTERVAL = []; SUMMA = 0; PRODUCT = 1;

def set_(line): global SET SET = list(map(int, line[1:-1].split(', '))) print(SET)

def interval_(line): global INTERVAL, SUMMA, PRODUCT interval, iterator, expression = line.split(' ') match interval[0]: case '(': l = int(interval[1])+1 case '[': l = int(interval[1]) match interval[-1]: case ')': r = int(interval[-2]) case ']': r = int(interval[-2])+1 INTERVAL = list(range(l, r)) if iterator: match iterator[0]: case 'A': for i in INTERVAL: SUMMA += SET[i] print(SUMMA) case 'P': for i in INTERVAL: PRODUCT = SET[i] print(PRODUCT)

def comment_(line): if line != '""': print(line) if line[-1] == '"': print()

def parse(line): match line[0]: case '"': comment_(line) case '{': set_(line) case '(' | '[': interval_(line) case 'I': print(sum([s*s for s in [e+sum(SET) for e in SET]])) # :-( case _: print(f'ERROR {line}')

def scan(f): for line in f: line = line.strip() if line: parse(line)

if __name__ == '__main__': f = open(sys.argv[1]); scan(f) f.close() ---------------------------------------------------- RESULT -------------------------------------------------- python ladder.py program.l "ladder - interpreted programming language" "this is a set (S) 1 2 3 4 5 "this is an amount (A) of the set (S) with an interval (I) 15 "this is the product (P) of the sum of the "elements of the set (S) and an amount (A) of the set (S) "with an interval (I) 1630

dghong a month ago

This is built by studying the leaked source. "Clean-room rewrite" doesn't mean much when you've read the original first — that's not clean-room, that's copying with extra steps.

The stars on the original claw-code repo were earned through the leak, not the work. Riding that wave with another clone doesn't make it original engineering.

Real open-source respects both the letter and the spirit of IP law.

truakon89 a month ago

How the hell did he rewrite the whole Claude Code in Python? and idk but did he also rewrite it in Rust?

how is this remotely possible? as Claude Code codebase was very large.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection