Skip to content
/ proton Public

A programming language written entirely in C++.

License

Notifications You must be signed in to change notification settings

855309/proton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

proton

A programming language written entirely in C++.

License

MIT License

Filetype

Default source file extension: .pfc.

Default header file extension: .pfh.

Syntax

Importing header files

You can import header files with eat keyword.

eat "header.pfh"

Variables

In this version of proton, all variables are global. So you can access and set them in everywhere. You can set them with assign keyword.

assign a 5

proton can determine what type is this.

You can get the value of the variable just writing its name. For example:

assign a 5

write a

Expressions

IF

A classic if expression.

Examples:

if 5 < 6 write "6 is bigger than 5"

if 90 > 6 write "90 is bigger than 6"

if "hi" is "hi" write "hi is equal to hi :D"

if "yes" not "no" write "yes is not no"

Loops

In proton, there isn't a unique expression for loop (like for, while) but you can make a loop with go keyword.

Example 1 (1, 2, 3... is line numbers):

1 meminit
2 assign a 1
3 write a
4 write end
5 assign a math sum a 1
6 go line 3

In line 6, the program goes to the third line and makes a loop goes forever.

(meminit: initializing base variables line end = end line = "\r\n")

Example 2:

1  meminit
2  assign a 1
3  
4  write a
5  write end
6  assign a math sum a 1
7  if a not 5 go line 3
8  write "5"
9  write end
10 write "done."

User Input / Output

read

read: makes the user must enter a value to continue the program.

Example:

assign a read

write "echo: "
write a

write

write: writes a output to the STDOUT.

Example:

write "hello world."

Points

A point is like a function but it's not. It isn't takes arguments. It's just a "point" to go.

(points can be in header files.)

Example:

meminit

point test
    write "hi"
endpoint

go test

memdump
exit

Example 2 (with a header file):

header.pfh:

meminit

point test
    write "Enter some text: "
    assign input read
    write "You entered: "
    write input
endpoint

source.pfc:

eat "header.pfh"

go test
write end
write "done."

memdump
exit

Other

exit

exits the program with an exit code (if it's specified).

Example 1:

write "hi"

exit

Example 2 (with a custom exit code):

write "hi"

exit -1

meminit

Initializes the memory with the base variables. like;

end: "\r\n"

back: "\b"

memdump

Deletes all variables from memory.

Convert

Converts a variable type to another.

assign a "15"

convert int a
or
convert double a

(in proton main integer type is double)

Contact

Discord: 85530#7651

E-mail: 855309@protonmail.com