Skip to main content

Asynchronous Low-code compiler for python

Project description

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 // | &s Not a Comment &s
""", 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
 | // Not a Comment //

Interactive Xfox Interpreter

python -m xfox

Start xfox files

python -m xfox (filename).xfox

Examples

Soon...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xfox-0.1.9.3.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

xfox-0.1.9.3-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file xfox-0.1.9.3.tar.gz.

File metadata

  • Download URL: xfox-0.1.9.3.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.6 Windows/10

File hashes

Hashes for xfox-0.1.9.3.tar.gz
Algorithm Hash digest
SHA256 58b0a9ea9b88fbfb8fb7e1ed22e567f3b0a28b8bb7aebfa11bd5a38bcb0d3764
MD5 1ee980f05d773d851438c092818c3da0
BLAKE2b-256 590219083fd25e7ff7b442f3bfb47f6ba3b4b84afde1c892f964bb98fb3b237c

See more details on using hashes here.

File details

Details for the file xfox-0.1.9.3-py3-none-any.whl.

File metadata

  • Download URL: xfox-0.1.9.3-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.6 Windows/10

File hashes

Hashes for xfox-0.1.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4cd5c7b4a7e6af85349ff86d46ad99bc40ce5371480e51dfd1d82e0c88bb57d7
MD5 877cff00cdd5e6cc086454c3809f79b5
BLAKE2b-256 1375b9f1720d39af011aa9ee614cd750fd4e07a291204a9dfe1df49df1eecd53

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page