Lightning fast and portable programming language!

Related tags

GraphQL Photon
Overview

Photon

Install on Convert to Run in

PT-BR Channel Contributions Welcome Discord Server

Documentation in English

Lightning fast and portable programming language!

What is Photon?

Photon is a programming language aimed at filling the gaps of the Python language with respect to performance and portability. I love Python, but I cannot use it anywhere I want because it is not a supported language of the platform, lacks performance or is very cumbersome to actually package it or deploy it. Photon applications can run in any platform. Some examples are: Windows, Linux, MacOS, BSD, Android, IOs, RaspberryPi, HTML5, Xbox, Playstation, etc.

I want to see it!

Devlog is available here. I also uploaded a video on my portuguese channel comparing it to Python and C, check it out here.

Quickstart

Download or clone (preferred) the repository where you want to install it. Execute the windowsInstaller.bat if you are in Windows or linuxInstaller.sh if you are in Linux. After the installation process, you should have photon installed and available in your PATH. Now you can write this simple Hello World, with any text editor of your choice.

print("Hello World!")

Save it as hello.w and then execute it in your cmd or powershell with

photon hello.w

And you should see the Hello World! output in your console!

In the devlog 1, I show how to install and create your first hello world program. Click here to see it.

ALPHA Stage

Photon is currently in alpha and not available to the general public yet. Launching a language while it is in development is not a good idea at the moment because I can't focus on its development and bug track. If you like this project and want to contribute, please consider donating or subscribing to my youtube channel, where I'll post a dev log of this language (devlog). Also, join the discussion here on github about the future and your thoughts on the language!

Documentação em português Linguagem de programação extremamente rápida e portátil!

O que é Photon?

Photon é uma linguagem de programação que visa preencher as lacunas da linguagem Python no que diz respeito ao desempenho e portabilidade. Eu amo Python, mas não posso usá-lo em qualquer lugar que eu queira porque não é uma nativamente suportada, não tem desempenho suficiente ou aprensenta muitas complicações para distribuir um executável na plataforma de destino. Por outro lado, os aplicativos Photon podem ser facilmente executados em qualquer plataforma. Alguns exemplos são: Windows, Linux, MacOS, BSD, Android, IOs, RaspberryPi, HTML5, Xbox, Playstation, etc.

Quero ver!

O Devlog está disponível aqui. Também carreguei um vídeo no meu canal português comparando-o com Python e C, confira aqui.

Estágio ALPHA

Photon está atualmente em alfa e não está disponível para o público em geral ainda. Lançar uma linguagem enquanto ela está em desenvolvimento não é uma boa ideia no momento porque não posso me concentrar em seu desenvolvimento e rastreamento de bug. Se você gosta deste projeto e deseja contribuir, considere doar ou se inscrever no meu canal youtube , onde postarei um dev log desta linguagem (devlog). Além disso, participe da discussão aqui no github sobre o futuro e sua opinião sobre a linguagem!

Documentación en español ¡Lenguaje de programación extremadamente rápido y portátil!

¿Qué es Photon?

Photon es un lenguaje de programación que tiene como objetivo llenar los vacíos en el lenguaje Python con respecto al rendimiento y la portabilidad. Me encanta Python, pero no puedo usarlo en cualquier lugar que quiera porque no es compatible de forma nativa, no tiene suficiente rendimiento o tiene muchas complicaciones para distribuir un ejecutable en la plataforma de destino. Por otro lado, las aplicaciones Photon se pueden ejecutar fácilmente en cualquier plataforma. Algunos ejemplos son: Windows, Linux, MacOS, BSD, Android, IOs, RaspberryPi, HTML5, Xbox, Playstation, etc.

¡Quiero ver!

El Devlog está disponible aquí. También subí un video en mi canal portugués comparándolo con Python y C, compruébalo aquí.

Etapa ALPHA

Photon se encuentra actualmente en alfa y aún no está disponible para el público en general. Lanzar un lenguaje mientras está en desarrollo no es una buena idea en este momento porque no puedo concentrarme en su desarrollo y seguimiento de errores. Si te gusta este proyecto y quieres contribuir, considera hacer una donación o suscribirte a mi canal de youtube, donde publicaré un registro de desarrollo de este idioma devlog ¡Además, participa en la discusión aquí en github sobre el futuro y tu opinión sobre el lenguaje!

Comments
  • Photon types

    Photon types

    Hi, here I go again. My question is about types. There exists long or double types? When I've tried to get a timestamp from time lib I've got type error in argument.

    This is the .w code:

    import time

    int t = time(NULL) str date = ctime(t) print(date)

    This is the error I get:

    Sources/c/main.c: In function ‘main’: Sources/c/main.c:13:24: warning: passing argument 1 of ‘ctime’ makes pointer from integer without a cast [-Wint-conversion] 13 | char* date = ctime(t); | ^ | | | long int In file included from Sources/c/main.c:5: /usr/include/time.h:142:14: note: expected ‘const time_t *’ {aka ‘const long int *’} but argument is of type ‘long int’ 142 | extern char *ctime (const time_t *__timer) __THROW; | ^~~~~ Regards

    opened by juanjavatus 5
  • New syntax proposal for accessing instance attributes

    New syntax proposal for accessing instance attributes

    Photon currently uses the 'self' name to identify the class instance.

    The proposed alternative (or optional) notation is: .attribute = 2 Instead of self.attribute = 2

    syntax proposal 
    opened by HashLDash 5
  • Erro Infering type \n {'value': 'type(a)', 'type': 'unknown'}

    Erro Infering type \n {'value': 'type(a)', 'type': 'unknown'}

    Frist i change the compiler language from py to C

    > PS C:\Users\Usuario\Desktop> photon -l c                                                                                
    > Setting default lang to: C
    > Some dependencies must be installed for this target language.
    > # PowerShell is installed!
    > # Chocolatey is installed!
    > # Installing dependency with Chocolatey - Command:
    > 
    > powershell -Command "Start-Process powershell -Verb RunAs -PassThru -Wait -ArgumentList \"/c choco install mingw; timeout /t 5; exit\""
    > 
    > # Result:
    > 
    > Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
    > -------  ------    -----      -----     ------     --  -- -----------
    >      18       4      428       2032       0,02   4344   6 powershell
    > Dependencies successfuly installed.
    

    After i tryed to execult my simple test code but that time i increaced the c in output space

    > PS C:\Users\Usuario\Desktop> photon test.w[enter]                                                                              
    > Infering type
    > {'value': 'type(a)', 'type': 'unknown'}c[enter]
    > Infering type
    > {'value': 'type(a)', 'type': 'unknown'}c[enter]
    > Traceback (most recent call last):
    >   File "C:\Photon-main\core\photon.py", line 127, in <module>
    >     Interpreter(filename = first, lang = lang, standardLibs = os.path.join(PHOTON_INSTALL_PATH, 'libs/'), debug = DEBUG).run()
    >   File "C:\Photon-main\core\interpreter.py", line 173, in run
    >     self.engine.process(struct)
    >   File "C:\Photon-main\core\transpilers\baseTranspiler.py", line 86, in process
    >     self.instructions[token['opcode']](token)
    >   File "C:\Photon-main\core\transpilers\baseTranspiler.py", line 498, in processAssign
    >     self.insertCode(self.formatAssign(variableName, varType, cast, expr, inMemory=inMemory))
    >   File "C:\Photon-main\core\transpilers\cTranspiler.py", line 390, in formatAssign
    >     varType = self.nativeType(varType) + ' '
    >   File "C:\Photon-main\core\transpilers\baseTranspiler.py", line 94, in nativeType
    >     raise NotImplemented
    > TypeError: exceptions must derive from BaseException
    
    But before i hasn't acreaced nothing
    
    
    > PS C:\Users\Usuario\Desktop> photon .\test.w [enter]
    >  Infering type
    > {'value': 'type(a)', 'type': 'unknown'} [enter]
    > Infering type
    > {'value': 'type(a)', 'type': 'unknown'}[enter]
    > 9 #real result
    > <class 'int'> #rial result
    
    

    This erro happen for that code

    int a = 9.5 print(a) b = type(a) print(b) ~ ~ ~
    PS: Sorry my english if i has something erro of grammar or sintax. PS: I love the idea of the a programmer language like photon, please fix it.

    opened by Samuel-Nonato 4
  • Idea for new logo

    Idea for new logo

    I made a little joke with the python logo kkk I'm registering as an idea, but if u approve, can be the new one.

    This is how photon.svg looks like, the insight is a "P" in front of another "P"

    photon.svg

    photon-alternative.svg is kinda fat, but stay as alternative

    photon-alternative

    opened by ntaraujo 4
  • Language name is already being used by other projects

    Language name is already being used by other projects

    As Marcus Lourenço said in my video on youtube, there are many other references for the term wlang on the internet. This can confuse people into looking into other projects instead. What you think of changing the name of the language. Name and extensions suggestions are welcome ^^

    opened by HashLDash 4
  • Function and Variable Names

    Function and Variable Names

    I know is your way of naming, I follow you time ago, but is not very 'pep'...

    Function and Variable Names

    Function names should be lowercase, with words separated by underscores as necessary to improve readability.

    Variable names follow the same convention as function names.

    mixedCase is allowed only in contexts where that’s already the prevailing style (e.g. threading.py), to retain backwards compatibility.

    opened by juanjavatus 3
  • 1.0  --> it is something??2 -- > Traceback (most recent call last):

    1.0 --> it is something??2 -- > Traceback (most recent call last):

    Those erro happen ..

    
    1. > PS C:\Users\Usuario\Desktop> photon numero.w
    2. > 1.0
    3. > it is something??2
    4. > Traceback (most recent call last):
    5. >   File "C:\Photon-main\core\interpreter.py", line 170, in run
    6. >     struct, nextLine = self.handleTokenized(tokenized)
    7. >   File "C:\Photon-main\core\interpreter.py", line 154, in handleTokenized
    8. >     struct = self.handleBlock(tokenized)
    9. >   File "C:\Photon-main\core\interpreter.py", line 137, in handleBlock
    10. >     block, nextTokenized = self.getBlock(indent)
    11. >   File "C:\Photon-main\core\interpreter.py", line 121, in getBlock
    12. >     struct, nextLine = self.handleTokenized(blockTokenized)
    13. >   File "C:\Photon-main\core\interpreter.py", line 154, in handleTokenized
    14. >     struct = self.handleBlock(tokenized)
    15. >   File "C:\Photon-main\core\interpreter.py", line 137, in handleBlock
    16. >     block, nextTokenized = self.getBlock(indent)
    17. >   File "C:\Photon-main\core\interpreter.py", line 114, in getBlock
    18. >     struct, nextLine = self.handleTokenized(blockTokenized)
    19. >   File "C:\Photon-main\core\interpreter.py", line 154, in handleTokenized
    20. >     struct = self.handleBlock(tokenized)
    21. >   File "C:\Photon-main\core\interpreter.py", line 137, in handleBlock
    22. >     block, nextTokenized = self.getBlock(indent)
    23. >   File "C:\Photon-main\core\interpreter.py", line 114, in getBlock
    24. >     struct, nextLine = self.handleTokenized(blockTokenized)
    25. >   File "C:\Photon-main\core\interpreter.py", line 157, in handleTokenized
    26. >     struct = assembly(tokenized)
    27. >   File "C:\Photon-main\core\photonParser.py", line 178, in assembly
    28. >     reduced = reduceToken(tokens)
    29. >   File "C:\Photon-main\core\photonParser.py", line 139, in reduceToken
    30. >     parsePhrase = token2word(tokens)
    31. >   File "C:\Photon-main\core\photonParser.py", line 116, in token2word
    32. >     raise Exception(f'Cannot convert the token {t["token"]} to a word')
    33. > Exception: Cannot convert the token value to a word
    34. > 
    35. > During handling of the above exception, another exception occurred:
    36. > 
    37. > Traceback (most recent call last):
    38. >   File "C:\Photon-main\core\photon.py", line 127, in <module>
    39. >     Interpreter(filename = first, lang = lang, standardLibs = os.path.join(PHOTON_INSTALL_PATH, 'libs/'), debug = DEBUG).run()
    40. >   File "C:\Photon-main\core\interpreter.py", line 172, in run
    41. >     showError(e)
    42. >   File "C:\Photon-main\core\photonParser.py", line 197, in showError
    43. >     raise SyntaxError(msg)
    44. > SyntaxError:
    45. > 
    46. > 
    47. >     Ops!! This is a syntax error or a parser error.
    48. >     Common causes: Missing "," ")" "}"
    49. >     Cannot convert the token value to a word
    50. >     This happened in line numero.w:11.
    51. >     Last parsed line is "
    52. > 
    53. >                          print('1º parte concluida {i*100/v}%')
    54. > 
    55. > "
    56. >     Last Parse attempt was:
    57. >  "assign"
    
    

    For this code

    
    1. > int n = input('n = ')
    2. > nome =input('nome = ')
    3. > int vezes = input('vezes = ')
    4. > v = vezes/3
    5. > v2= 2*v
    6. > str t = ('')
    7. > for i in 0..vazes:
    8. >       n = n + 1
    9. >       if i:
    10. >             if i <=v:
    11. >                      print('1º parte concluida {i*100/v}%')
    12. >             if i>v and i <=v2:
    13. > 		     print('2º parte concluida {i*100/v}%')  
    14. >             if i>v and i <=vezes:
    15. >                      print('3º parte concluida {i*100/v}%')	
    16. >       t = t +str(n) + str('\n')
    17. > print(t)
    18. > 
    
    
    opened by Samuel-Nonato 3
  • Unable to import pimport library from photon. (FFI Support)

    Unable to import pimport library from photon. (FFI Support)

    https://www.youtube.com/watch?v=Q8shKuNPP2o&t=3815s

    File: main.w

    def compute():
        print("ok")
    

    File: ffi_example.py

    from photon import pimport
    main = pimport("main")
    main.compute()
    

    To generate the shared constructor file (main.so or main.dll) you need to use the command:

    photon --build shared # Currently, it only works if the file is called `main.w`
    python ffi_example.py
    
    Feature 
    opened by matheusjohannaraujo 3
  • Implement dict iteration

    Implement dict iteration

    
    int:int dict_int = {}
    dict_int[1] = 1
    dict_int[2] = 4
    dict_int[3] = 9
    dict_int[4] = 16
    
    del dict_int[2]
    
    # This structure only works if the list key is a sequence of integers.
    for i in 1..dict_int.len+1:
        print("The key {i} contains the value {dict_int[i]}")
    
    
    int:int dict_int = {}
    dict_int[1] = 1
    dict_int[2] = 4
    dict_int[3] = 9
    dict_int[4] = 16
    
    del dict_int[2]
    
    # This structure does not work in the list-only dictionary.
    for key, value in dict_int:
        print("The key {key} contains the value {value}")
    
    
    Feature 
    opened by matheusjohannaraujo 3
  • System wide installation for Windows

    System wide installation for Windows

    Implements #9

    I strongly recommend do not use it in future. Windows is kinda dumb and needs a better approach for running this safely. Maybe PyInstaller with InnoSetup.

    The installation method presupposes python is available in %PATH%

    opened by ntaraujo 3
  • The list informed as the function's argument has its value lost.

    The list informed as the function's argument has its value lost.

    File: test.w

    def add_list(int list = []):
        print("Received:")
        print(list)
        print()
        int sum = 0
        for num in list:
            print(num)
            sum += num
        return sum
    
    int list = [1, 2, 3]
    
    print("Add = {add_list(list)}")
    

    photon test.w

    Received:
    []
    Add = 0
    
    opened by matheusjohannaraujo 2
  • Raylib is not being installed in Ubuntu

    Raylib is not being installed in Ubuntu

    I've installed photon and I've tried to execute the basic code to simply open the ui window and I have got the following error:

    Sources/c/main.c:7:10: fatal error: raylib.h: No existe el archivo o el directorio.(File or folder does not exists)

    What should i do? Thanks in advance

    bug 
    opened by juanjavatus 10
  • The `for lang` does not work on targets: D, Dart and Haxe

    The `for lang` does not work on targets: D, Dart and Haxe

    
    for C:
        print("Target C")
    
    for D:
        print("Target D")
    
    for JS:
        print("Target JavaScript")
    
    for DART:
        print("Target Dart")
    
    for HAXE:
        print("Target Haxe")
    
    for PY:
        print("Target Python")
    
    
    Feature future 
    opened by matheusjohannaraujo 1
  • Create namespaces

    Create namespaces

    When combining multiple sources and libraries, it is useful to use namespaces to avoid naming conflicts.

    We can use the path of the file to create the namespace.

    Feature 
    opened by HashLDash 0
Owner
William
I'm William, owner of HashLDash/HashLDash English channels. Also @Huyston here on github, contributing to many open-source projects. Also teaching programming.
William
MGE-GraphQL is a Python library for building GraphQL mutations fast and easily

MGE-GraphQL Introduction MGE-GraphQL is a Python library for building GraphQL mutations fast and easily. Data Validations: A similar data validation w

MGE Software 4 Apr 23, 2022
Blazing fast GraphQL endpoints finder using subdomain enumeration, scripts analysis and bruteforce.

Graphinder Graphinder is a tool that extracts all GraphQL endpoints from a given domain. Run with docker docker run -it -v $(pwd):/usr/bin/graphinder

Escape 76 Dec 28, 2022
GraphQL is a query language and execution engine tied to any backend service.

GraphQL The GraphQL specification is edited in the markdown files found in /spec the latest release of which is published at https://graphql.github.io

GraphQL 14k Jan 1, 2023
This is a graphql api build using ariadne python that serves a graphql-endpoint at port 3002 to perform language translation and identification using deep learning in python pytorch.

Language Translation and Identification this machine/deep learning api that will be served as a graphql-api using ariadne, to perform the following ta

crispengari 2 Dec 30, 2021
Django registration and authentication with GraphQL.

Django GraphQL Auth Django registration and authentication with GraphQL. Demo About Abstract all the basic logic of handling user accounts out of your

pedrobern 301 Dec 9, 2022
Django Project with Rest and Graphql API's

Django-Rest-and-Graphql # 1. Django Project Setup With virtual environment: mkdir {project_name}. To install virtual Environment sudo apt-get install

Shubham Agrawal 5 Nov 22, 2022
GraphQL security auditing script with a focus on performing batch GraphQL queries and mutations

BatchQL BatchQL is a GraphQL security auditing script with a focus on performing batch GraphQL queries and mutations. This script is not complex, and

Assetnote 267 Dec 24, 2022
Generate a FullStack Playground using GraphQL and FastAPI 🚀

FastQL - FastAPI GraphQL Playground Generate a FullStack playground using FastAPI and GraphQL and Ariadne ?? . This Repository is based on this Articl

OBytes 109 Dec 23, 2022
This is a minimal project using graphene with django and user authentication to expose a graphql endpoint.

Welcome This is a minimal project using graphene with django and user authentication to expose a graphql endpoint. Definitely checkout how I have mana

yosef salmalian 1 Nov 18, 2021
🔪 Facebook Messenger to email bridge based on reverse engineered auth and GraphQL APIs.

Unzuckify This repository has a small Python application which allows me to receive an email notification when somebody sends me a Facebook message. W

Radon Rosborough 33 Dec 18, 2022
A Django GraphQL Starter that uses graphene and graphene_django to interface GraphQL.

Django GraphQL Starter GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data... According to the doc

0101 Solutions 1 Jan 10, 2022
A plug and play GraphQL API for Wagtail, powered by Strawberry 🍓

Strawberry Wagtail ?? A plug and play GraphQL API for Wagtail, powered by Strawberry ?? ⚠️ Strawberry wagtail is currently experimental, please report

Patrick Arminio 27 Nov 27, 2022
Jiminy, fast and portable Python/C++ simulator of poly-articulated systems with OpenAI Gym interface for reinforcement learning.

Jiminy is a fast and portable cross-platform open-source simulator for poly-articulated systems. It was built with two ideas in mind: provide a fast y

Alexis DUBURCQ 122 Dec 29, 2022
Lightning Fast Language Prediction 🚀

whatthelang Lightning Fast Language Prediction ?? Dependencies The dependencies can be installed using the requirements.txt file: $ pip install -r req

Indix 152 Oct 16, 2022
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

Advent Of Code 2021 - Python English Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels th

Coral Izquierdo Muñiz 2 Jan 9, 2022
A programming language built on top of Python to easily allow Swahili speakers to get started with programming without ever knowing English

pyswahili A programming language built over Python to easily allow swahili speakers to get started with programming without ever knowing english pyswa

Jordan Kalebu 72 Dec 15, 2022
Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Dask, Flink and DataFlow

eXtreme Gradient Boosting Community | Documentation | Resources | Contributors | Release Notes XGBoost is an optimized distributed gradient boosting l

Distributed (Deep) Machine Learning Community 23.6k Dec 31, 2022
Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Dask, Flink and DataFlow

eXtreme Gradient Boosting Community | Documentation | Resources | Contributors | Release Notes XGBoost is an optimized distributed gradient boosting l

Distributed (Deep) Machine Learning Community 20.6k Feb 13, 2021
Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Dask, Flink and DataFlow

eXtreme Gradient Boosting Community | Documentation | Resources | Contributors | Release Notes XGBoost is an optimized distributed gradient boosting l

Distributed (Deep) Machine Learning Community 23.6k Jan 3, 2023
The lightning-fast ASGI server. ?

The lightning-fast ASGI server. Documentation: https://www.uvicorn.org Community: https://discuss.encode.io/c/uvicorn Requirements: Python 3.6+ (For P

Encode 6k Jan 3, 2023