Skip to content

Commit 0759273

Browse files
pirapiraclaude
andcommitted
Rename project from Lython to leanPython
Rename directories, files, namespaces, imports, and git remote URL. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5b0802a commit 0759273

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+202
-202
lines changed

CLAUDE.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# Lython
1+
# LeanPython
22

33
Python 3.12 interpreter in Lean4, targeting the leanSpec Ethereum consensus spec.
44

55
## Build Commands
66

7-
- `lake build` — build the Lython library and executable
8-
- `lake test` — run tests (builds LythonTest driver; `#guard` failures = build errors)
9-
- `lake exe lython` — run the interpreter
7+
- `lake build` — build the LeanPython library and executable
8+
- `lake test` — run tests (builds LeanPythonTest driver; `#guard` failures = build errors)
9+
- `lake exe leanPython` — run the interpreter
1010

1111
## Project Structure
1212

1313
```
14-
Lython.lean — umbrella import for the library
15-
Lython/
14+
LeanPython.lean — umbrella import for the library
15+
LeanPython/
1616
Lexer.lean — tokenizer entry point (imports sub-modules, exposes tokenize)
1717
Lexer/
1818
Types.lean — SourcePos, SourceSpan, TokenKind, Token, LexError
@@ -46,8 +46,8 @@ Lython/
4646
Ops.lean — Operator dispatch, truthiness, equality, comparison, iteration
4747
Builtins.lean — Built-in function implementations (print, len, range, etc.)
4848
Main.lean — CLI entry point (reads .py file, parses, interprets)
49-
LythonTest.lean — test driver root
50-
LythonTest/
49+
LeanPythonTest.lean — test driver root
50+
LeanPythonTest/
5151
Basic.lean — lexer tests (keywords, operators, numbers, strings, indent)
5252
Parser.lean — parser tests (expressions, statements, integration)
5353
Interpreter.lean — interpreter tests (#eval-based, IO assertions)

LeanPython.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import LeanPython.Lexer
2+
import LeanPython.Parser
3+
import LeanPython.AST
4+
import LeanPython.Interpreter
5+
import LeanPython.Runtime
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import Lython.AST.Types
1+
import LeanPython.AST.Types
22

33
set_option autoImplicit false
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import Lython.Lexer.Types
1+
import LeanPython.Lexer.Types
22

33
set_option autoImplicit false
44

5-
namespace Lython.AST
5+
namespace LeanPython.AST
66

7-
open Lython.Lexer (SourceSpan)
7+
open LeanPython.Lexer (SourceSpan)
88

99
/-- Binary operators for `Expr.binOp`. -/
1010
inductive BinOp where
@@ -384,4 +384,4 @@ end
384384
def dumpModule : Module → String
385385
| .module stmts => s!"Module({dumpList dumpStmt stmts})"
386386

387-
end Lython.AST
387+
end LeanPython.AST

LeanPython/Interpreter.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import LeanPython.Interpreter.Types
2+
import LeanPython.Interpreter.Eval
3+
import LeanPython.Interpreter.Core
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import Lython.Interpreter.Eval
2-
import Lython.Parser.Core
1+
import LeanPython.Interpreter.Eval
2+
import LeanPython.Parser.Core
33

44
set_option autoImplicit false
55

6-
namespace Lython.Interpreter
6+
namespace LeanPython.Interpreter
77

8-
open Lython.AST (Module)
9-
open Lython.Runtime
10-
open Lython.Interpreter.Eval
11-
open Lython.Parser (parse)
8+
open LeanPython.AST (Module)
9+
open LeanPython.Runtime
10+
open LeanPython.Interpreter.Eval
11+
open LeanPython.Parser (parse)
1212

1313
/-- Interpret a Python source string.
1414
Returns captured output lines on success, or an error message. -/
@@ -28,4 +28,4 @@ def interpret (source : String) : IO (Except String (List String)) := do
2828
| (.error (.control .continue_), _) =>
2929
return (.error "SyntaxError: 'continue' not properly in loop")
3030

31-
end Lython.Interpreter
31+
end LeanPython.Interpreter
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import Lython.Runtime.Builtins
1+
import LeanPython.Runtime.Builtins
22
import Std.Data.HashMap
33
import Std.Data.HashSet
44

55
set_option autoImplicit false
66

7-
namespace Lython.Interpreter.Eval
7+
namespace LeanPython.Interpreter.Eval
88

9-
open Lython.AST
10-
open Lython.Runtime
11-
open Lython.Runtime.Ops
12-
open Lython.Runtime.Builtins
13-
open Lython.Interpreter
14-
open Lython.Lexer (SourceSpan SourcePos)
9+
open LeanPython.AST
10+
open LeanPython.Runtime
11+
open LeanPython.Runtime.Ops
12+
open LeanPython.Runtime.Builtins
13+
open LeanPython.Interpreter
14+
open LeanPython.Lexer (SourceSpan SourcePos)
1515

1616
-- ============================================================
1717
-- Helpers
@@ -1074,4 +1074,4 @@ partial def callSetMethod (ref : HeapRef) (method : String) (args : List Value)
10741074

10751075
end
10761076

1077-
end Lython.Interpreter.Eval
1077+
end LeanPython.Interpreter.Eval
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import Lython.Runtime.Types
1+
import LeanPython.Runtime.Types
22
import Std.Data.HashMap
33
import Std.Data.HashSet
44

55
set_option autoImplicit false
66

7-
namespace Lython.Interpreter
7+
namespace LeanPython.Interpreter
88

9-
open Lython.Runtime
9+
open LeanPython.Runtime
1010

1111
-- ============================================================
1212
-- Control flow signals
@@ -318,4 +318,4 @@ def typeName : Value → String
318318
| .builtin _ => "builtin_function_or_method"
319319
| .ellipsis => "ellipsis"
320320

321-
end Lython.Interpreter
321+
end LeanPython.Interpreter

LeanPython/Lexer.lean

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import LeanPython.Lexer.Types
2+
import LeanPython.Lexer.Keywords
3+
import LeanPython.Lexer.Operators
4+
import LeanPython.Lexer.State
5+
import LeanPython.Lexer.Char
6+
import LeanPython.Lexer.Indent
7+
import LeanPython.Lexer.Number
8+
import LeanPython.Lexer.StringLit
9+
import LeanPython.Lexer.Core
10+
11+
set_option autoImplicit false
12+
13+
namespace LeanPython.Lexer
14+
15+
/-- Tokenize a Python source string into an array of tokens. -/
16+
def tokenize (source : String) : Except LexError (Array Token) :=
17+
match lexAll.run (LexerState.initial source) with
18+
| .ok (tokens, _) => .ok tokens
19+
| .error err => .error err
20+
21+
end LeanPython.Lexer
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set_option autoImplicit false
22

3-
namespace Lython.Lexer
3+
namespace LeanPython.Lexer
44

55
/-- Is the character a valid Python identifier start? (ASCII subset) -/
66
def isIdentStart (c : Char) : Bool :=
@@ -26,4 +26,4 @@ def isHexDigit (c : Char) : Bool :=
2626
def isHorizWhitespace (c : Char) : Bool :=
2727
c == ' ' || c == '\t' || c == '\x0C'
2828

29-
end Lython.Lexer
29+
end LeanPython.Lexer

0 commit comments

Comments
 (0)