pyfdev
pyfdev is a minimal, statically‑typed subset of Python that compiles to C via Tiny C Compiler (TCC). It offers Python‑like syntax with the performance of native C, right out of the box.
🚀 Features Implemented So Far
Basic Types & Declarations
num→int(e.g.num x = 5)real→double(e.g.real pi = 3.14)text→char*(e.g.text msg = "hello")yesno→bool(e.g.yesno flag = true)list→ homogeneous arrays + length (e.g.list nums = [1,2,3]orlist words = ["a","b"])
Arithmetic & Boolean Expressions
- Operators:
+,-,*,/,% - Comparisons:
==,!=,<,>,<=,>= - Logical:
&&,||,! - Mixed numeric/float expressions infer
%dor%fautomatically inprint()
Printing
-
print(expr)handles:- String literals and
textvariables (%s) - Numeric and boolean (
num/yesno) (%d) - Floating-point (
real) (%f) - Lists: prints
[elem0, elem1, …]
- String literals and
Control Flow Extensions
-
if/elif/elseblocks with Python‑style indentation -
unless cond:inverse-ifsugar -
Guarded clauses:
if cond when guard: -
Early-exit guard:
guard cond else: -
Ternary expressions:
cond ? val1 : val2 -
Range membership:
x in a..b→x >= a && x <= b -
Pattern matching:
match x { case 0: print("zero") case 1: print("one") default: print("many") }
⚙️ Installation
pyfdev provides a one‑step installer that sets up the CLI and automatically installs Tiny C Compiler (TCC) on your system.
Requirements
- Python 3.7+ installed
- On Linux/macOS: a system package manager (
apt,dnf,brew, etc.) - On Windows: PowerShell with administrative privileges (for package manager install)
Install via pip
pip install pyfdev
pyfdev --install-tcc # automatically installs TCC if missing
The --install-tcc flag will detect your OS and run:
- Debian/Ubuntu:
sudo apt-get update && sudo apt-get install tcc - Fedora/Red Hat:
sudo dnf install tcc - macOS (Homebrew):
brew install tcc - Windows (Chocolatey):
choco install tcc
Or combine into one command:
pip install pyfdev && pyfdev --install-tcc
📦 Usage
-
Write your pyfdev code in a
.pffile, e.g.hello.pf:num x = 10 if x > 5: print("big") else: print("small") -
Compile & Run in one step:
pyfdev hello.pfThis generates
hello.c, compiles it with TCC, and runs the executable. -
Separate Steps (optional):
pyfdev --transpile hello.pf # emits hello.c pyfdev --compile hello.c # emits hello.exe or ./hello pyfdev --run hello.exe # runs the binary
🧪 Testing Features
-
Expressions & Prints:
num a = 5 + 3 * 2 real ratio = a / 2.0 print(a) print(ratio)
-
Control Flow:
num x = 3 unless x > 5: print("x is small") guard x < 0 else: print("x >= 0") return -
Ternary & Ranges:
num y = 7 print((y % 2 == 0) ? "even" : "odd") print(y in 1..10)
-
Match/Case:
num code = 2 match code { case 1: print("one") case 2: print("two") default: print("other") }
📚 Further Development
- Add
whileandforloops - User-defined functions and modules
- Enhanced error reporting with line numbers
- Standard library built-ins (e.g.
len(),append())
Contributions welcome! Submit issues and pull requests on GitHub: https://github.com/yourusername/pyfdev
Happy coding with pyfdev!
Metadata
Release files for pyfdev 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyfdev-0.1.7.tar.gz | 8.1 kB | Without provenance | Details for pyfdev-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyfdev-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for pyfdev-0.1.7-py3-none-any.whl |
Total release size: 15.5 kB
Release files / pyfdev-0.1.7.tar.gz
| Download URL | pyfdev-0.1.7.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa51a6aae5660ea6a54b411c0eb90ab2b18b1568b76bd604a351082c207293b2
|
|
BLAKE2b-256 checksum How to use checksums |
efad02c103a489295798685c30b490a4a65b7c01da8ee40a4711ba8072bb742b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Release files / pyfdev-0.1.7-py3-none-any.whl
| Download URL | pyfdev-0.1.7-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c1afe76320869dfb50c3950af8fe65ef12e7923e1e4582bb5cba8663b540b60
|
|
BLAKE2b-256 checksum How to use checksums |
24bbccf63141f9d0be29fb7943b04ebb2c77d463fb921ee5ddf8f43fa7340020
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Security for pyfdev 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.