Skip to main content

Asynchronous Low-code compiler for python

github

How to install

pip install xfox

Optional

pip install termcolor

Example

import asyncio
import xfox
#Custom Function

@xfox.addfunc(xfox.funcs)
async def test_func(item:str, *args, **kwargs):
    print("-----",kwargs)

@xfox.addfunc(xfox.funcs)
async def somef(item:str,*args, **kwargs):
    return kwargs["ctx"]

@xfox.addfunc(xfox.funcs)
async def function4(*args, **kwargs):
    return "FOX"

@xfox.addfunc(xfox.funcs)
async def function1(item:int, type:bool,*args, **kwargs):
    return type, args

@xfox.addfunc(xfox.funcs)
async def function2(item:str, *args, **kwargs):
    await xfox.isempty(item)
    return eval(item)

@xfox.addfunc(xfox.funcs)
async def inside(item:str, type:bool=False,*args, **kwargs):
    return type

@xfox.addfunc(xfox.funcs, 'usefunc')
async def functest(func:xfox.AnonFunction,*args, **kwargs):
    return (await func.compile(), func.name)



# Sync Parsing

print(asyncio.run(xfox.parse("""
/* TRASH (xd) */
$test_func[$test_func[sfsaf]]
$function1[1;$inside[true];$sadsadsdsd[]] $onlyif[1<2;ONLYIF]
$function2[1+2;dsadasd] sometext
$function4[]
$function1[1;$inside[fsfdfd;true];$sadsadsdsd[]]
$sdasdasd[sadsadsad]
sdasdsa $exec[true;print(1+231321, end='')] $exec[true;print(1+231321, end='')] $exec[true;print(1+231321, end='')]

/* Let/Get */
$let[test;good]
$get[test]

/* Internal Functions Test */
$usefunc[$def[$print[hello!]]]
$Test[]
$def[$print[hello!];Test]
$Test[] 
                             
/* While Test */
$let[a;0]
$while[$eval[$get[a]<=5];$let[a;$eval[$get[a]+1]]]
$get[a]
123 $while[True;$if[$get[a]<15;$let[a;$eval[$get[a]+1]];$break[]] $get[a]]
123 $while[True;$break[]]
$break[]

/* DoWhile Test */
$dowhile[1>2;Test]
                             
/* For Test */
$for[1..5;$get[i]]
$for[0..100..10;$get[i]]
$for[5;$if[$get[i]==2;$break[];$get[i]]]

/* Try Test */
$try[ERROR $get[_];$function1[]] 
$try[$print[$get[_]];$function2[]]
$try[$get[_];$raise[name;text]]

/* Import usage
$import[ttest]
$functiomm[] <- (custom function from ttest) */

/* Exit - $exit[] */
                                                                              
/* a Comment */ <-- comment here
""", ctx="asdsdsdasds",del_empty_lines=True)))

Output:

----- {'ctx': 'asdsdsdasds'}
----- {'ctx': 'asdsdsdasds'}
[LOG] hello!
[LOG] hello!
[LOG] Mising var item in function2
None
(False, ('$sadsadsdsd[]',))
3 sometext
FOX
(True, ('$sadsadsdsd[]',))
$sdasdasd[sadsadsad]
sdasdsa 231322 231322 231322
good
('', 'a547f0')
$Test[]
6
123 789101112131415
123
Test
12345
0102030405060708090100
01
ERROR Mising var type in function1
[ERROR] name: text
 <-- comment here

Interactive Xfox Interpreter

python -m xfox

Start xfox files

python -m xfox (filename).xfox

Examples

Soon...

Metadata

Release files for xfox 0.1.9.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xfox 0.1.9.6
File Size Uploaded
xfox-0.1.9.6.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xfox 0.1.9.6
File Interpreter ABI Platform
xfox-0.1.9.6-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / xfox-0.1.9.6.tar.gz

Download URL xfox-0.1.9.6.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
60bad6e2e5d093da2b8810fbb9ebfb1afde107fa78410875e7b17dde5c5b1556
BLAKE2b-256 checksum
How to use checksums
36740eef505e995ca31984934bde33627bc50d678f4dc16f80f52d97229e14fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.2 Linux/6.13.7-200.nobara.fc41.x86_64

Release files / xfox-0.1.9.6-py3-none-any.whl

Download URL xfox-0.1.9.6-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
389a2de1672cd4b9f8934b1dc7ac87b4c7e5cb37d171e15095f901cfd7f4e7bf
BLAKE2b-256 checksum
How to use checksums
97a99dbce7bf03c656faddaa41a14b9be22c224c4091eeb7286312fce19cb580
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.2 Linux/6.13.7-200.nobara.fc41.x86_64
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page