4U (Programming language)

The 4U is created by @LAPCoder. It's a programming language. Thanks @Yagi-404 for his (big) help.

GitHub release License Downloads GitHub branch checks state GitHub code size in bytes GitHub commit activity GitHub Release Date Language count GitHub deployments GitHub Discussions GitHub issues GitHub closed issues GitHub pull requests GitHub closed pull requests Security Headers Code Scanning - Action Lines of code GitHub last commit

                       _____   _____   _____   _____    ___    _   _   _   _   _____   _   _   _____ 
    ____   _      _   |  .  \ |  .  \ /  _  \ /  ___\  / ^ \  | \_/ | | \_/ | |_   _| |  \| | /  ___\
   / _  | | |    | |  |  ___/ |  _  / | |_| | | |_]¨; /  _  \ | \_/ | | \_/ |  _| |_  | \ \ | | |_]¨;
  / / | | | |    | |  |_|     |_| \_\ \_____/ \_____/ |_| |_| |_| |_| |_| |_| |_____| |_|\__| \_____/
 / /__| |_| |    | |   _        ___    _   _   _____   _   _    ___    _____   _____ 
/___    __  \____/ /  | |      / ^ \  |  \| | /  ___\ | | | |  / ^ \  /  ___\ |  ---'
    |__|   \______/   | |___  /  _  \ | \ \ | | |_]¨; | \_/ | /  _  \ | |_]¨; |  ̅_̅_]
                      |_____| |_| |_| |_|\__| \_____/ \_____/ |_| |_| \_____/ |__͞_͞_͞_]

What is it?

This is not only a programming language. It will be a code editor, a programming language, a doc, an IDE, an ODE, an extension for VS Code… The VS Code extension is here.

The Latest version

v0.0.1 is the latest version. v1.0.0 is in development (go in in-dev branch).

Objective

The main goal is to be useful, powerful, accessible, and easy to use.

Goal:

Simpler than Python, more complete than C++, more object-oriented than Java, more interpreted than Python, more compiled than C, more cross-platform than HTML, here is the 4U!

Unfortunately, we are far from the goal. So it is (and still) in (perpetual) development.

For understanding:

Simpler than Python

The goal of language is to be accessible to everyone.

More complete than C++

The 4U will have many functionalities (applications, games, websites, 2D, 3D, sound, image…).

More object than Java, more interpreted than Python

It will be compiled and interpreted:

  • For a quick overview (when designing software), it can be interpreted.
  • For a slower rendering (but faster to execute), it can be compiled in machine language (as currently).

More cross-platform than HTML

The 4U will be cross-platform.

How to use

You must have gcc, bison or yacc, flex or lex and glib.


Warning! For all commands, do not enter the $, the # or the C:\>!


1: Go to your directory

Windows

On Windows, type this command:

cd <directory name>

<directory name> is the directory where you installed folder "4u vX.X.X" (X.X.X is your version number). The path is like C:\Users\user\Documents\src\'4U 0.0.0'

Linux

On Linux, type this command:

cd <directory name>

<directory name> is the directory where you installed folder "4u vX.X.X" (X.X.X is your version number). The path is like /home/user/Documents/src/'4U 0.0.0' or ~/Documents/src/'4U 0.0.0'.

2: Compile the lexical analyzer

Type this command (if you use flex):

flex -o lexique_4u.c lexique_4u.lex

3: Compile the syntax analyzer

Type this command (if you use bison):

bison -d syntax_4u.y

4: Compile the compiler

v0.x.x

Type this command (if you use gcc) to compile the compiler:

gcc lexique_4u.c syntax_4u.tab.c generation_code.c `pkg-config --cflags --libs glib-2.0` -o 4u

v1.x.x

Type this command (if you use gcc) to compile the compiler:

gcc lexique_4u.c syntax_4u.tab.c generation_code_c.c generation_code_js.c `pkg-config --cflags --libs glib-2.0` -o 4u

5: Execute the 4U program

Type this command (if you use gcc) in a terminal to transform the 4U code in C:

./4u program.4u

<program.4u> is the name of your program.

6: Compile the program

Type this command to compile the C program:

gcc program.c

<program.c> is the name of your program (compiled).

7: Compile the program

Windows

Type this command to run the compiled program:

./a.exe

Linux

Type this command to run the compiled program:

./a.out

8: End

It's OK! Your code was executed! If you want to re-execute your code (and it's not changed), you can just do this command (step 7). Else, you can execute (if you want):

cd

Compile Command

AT THE TIME, THE COMMAND DOESN'T WORK. WE HIGHLY RECOMMEND NOT INSTALLING NOW. IT'S COMING SOON, BUT AT THE TIME IT'S IN BETA.

You can go here for more informations.

Windows

To compile command, here is a simple way to do it on Windows. Go to the 4U command file and type:

C:\> mkdir bin

C:\> gcc *.c -o bin/4U

It will create an executable. If you want to use it all days, we really recommend add the bin/ folder into the PATH.

Whatever, if you want a normal installation of the 4U command (without compiling), we'll put an executable file in our website soon. You need to put it in a folder that you added to PATH.

Linux

Sorry, at the moment commands are not tested for Linux. But you can try compiling them with gcc.

Thanks

We use this tutorial. Thanks to @totodunet.

QR Code

QR code

Logo

4U logo

LICENSE

See LICENSE.md for more information.

Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.