Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🕴️ Write a draft for Mission Statement of The One Programming Language🕴️ #30

Open
BaseMax opened this issue May 25, 2021 · 31 comments
Labels
documentation Enhancement New feature or request Good First Issue Good for newcomers hacktoberfest Help Wanted Extra attention is needed Question Further information is requested

Comments

@BaseMax
Copy link
Member

BaseMax commented May 25, 2021

HI

We are in early stage and need help of everyone, so please come on and help to each other and write mission statement for the project.

https://github.com/One-Language/One/blob/master/MISSION_STATEMENT.md

I am looking forward to see some PR for this file.

@BaseMax
Copy link
Member Author

BaseMax commented May 25, 2021

Mission Statement of a big project as GCC:
https://gcc.gnu.org/gccmission.html

Mission Statement of similar projects:

@BaseMax BaseMax self-assigned this May 25, 2021
@BaseMax
Copy link
Member Author

BaseMax commented May 25, 2021

F# is a mature, open source, cross-platform, functional-first programming language. It empowers users and organizations to tackle complex computing problems with simple, maintainable and robust code.

The mission of the F# Software Foundation is to promote and advance the F# programming language, including a diverse and international community of F# programmers.

https://fsharp.org/

@BaseMax
Copy link
Member Author

BaseMax commented May 25, 2021

Mission Statement of Python:

The mission of the Python Software Foundation is to promote, protect, and advance the Python programming language, and to support and facilitate the growth of a diverse and international community of Python programmers.

The Python Software Foundation (PSF) is a non-profit membership organization devoted to advancing open source technology related to the Python programming language. It qualifies under the US Internal Revenue Code as a tax-exempt 501(c)(3) scientific and educational public charity, and conducts its business according to the rules for such organizations.

https://www.python.org/psf/mission/

@jbampton jbampton added documentation Enhancement New feature or request labels May 25, 2021
@BaseMax
Copy link
Member Author

BaseMax commented May 25, 2021

Hey John,
I think it is better to write this ourselves.
Because translators do not have enough computer skills and may not be able to write.

If possible, write this yourself.
We are gradually upgrading and improving.

Finally, we get help from translators to improve the text.
But first we have to work.

And so, I am looking forward to see your PR.


Mission Statement of The One Programming Language

  • Explanation of requirements and situation of programmer with current interpreters and compilers
  • And explain the project objectives and purposes

A draft summary from whole of the project

What does this means? A tool to write command-line software.

system-level, processing tool, doing calculate, for mathematics purpose, etc.
E.g: C, Go, Rust, C++

Similar to what we learned in university from Programming session.

read input / do calculation / show output

And now, Why they should choose One and not C?
Because we are prepared so many required functionality and features. Somethings usually needed in most projects.

So developers can write/develop programs easily
And some features of this language cause to decrease bugs when developing a program.

This is first step of project.

==================

At the next step, we want to release a framework for web.
And purpose of this is to design/create websites without learn another tool and language.

In general, you need to learn at least 3-4 languages or more tools to create a website.
But we want to everyone can create a website without learning anythings more. by using only One language in same syntax.

Some draft and messages between my recent inbox

This is just to get a basic idea of what you can say and how you think:

The ease of our language in the library will be determined at runtime, and this is not a matter of the first stage.

It's why a person does not use C and comes here to use One. because it's really nice with many needed features.

Some of the features we have can bring Python comfort to C.


We want to help developers to write less bugs and more useful programs.

Did you say C? It does not have a package manager at all. A very necessary tool is the package manager. So that others can manage libraries more easily.
Of course, it should not be like npm chaotic.
The package manager designed in Python and Go is nice and clean.

Next we need to keep runtime library functions to work in Windows, Linux, macOS as well.

In the next step, it will be determined when you can design the site using the same language.
This is what I will design in the next step.


Languages like Python and PHP are good.
But they are not compilers and have other problems.

We need to keep some features of script language in a compiler / system language.
I am not talking about static variables, What I mean is more than that. Usually in script interpreter languages we have many good features and functions.
But they are mostly lost in C.

Developers need to be able to create secure executable files / output from the program source.

For example: PHP is a good language, but it's not clear. Why not clean?

unlink(): remove a file
fopen(): open a file to read/write/append
file_put_contents(): open a file to write/append
file_get_contents(): open a file to read

See function names, they are really bad. Why deleting a file is not related to other function names.

What we want to design is: file.create() , file.delete(), file.copy() and etc.

These examples do not end here and continue.
I hope I was able to convey my meaning to you.

This is what I wrote two years ago:
https://github.com/One-Language/STD


Maybe the reasons I mentioned are enough for a good language. But we do not want to produce a good product. We have to make something great.

I'm not going to make anything for myself. It's supposed to be something that helps others. So I should not be alone. Maybe you have ideas that we can take into and make a better product.
So your ideas are highly appreciated. I can say you have good experiences.

I end my message with a sentence from a businessman: Fall in love with your customers' problems. Do not love your product.

read more: https://medium.com/productboard/fall-in-love-with-your-customers-problem-not-their-solution-90bd0cf2d842

@BaseMax BaseMax mentioned this issue May 25, 2021
@n4i9kita
Copy link
Contributor

@BaseMax may I help in writing a draft ?

@n4i9kita
Copy link
Contributor

Or, may I help with some other issues right now ?

@BaseMax
Copy link
Member Author

BaseMax commented May 25, 2021

Hello again
Nikata, you can do this. Try to improve/draft MISSION STATEMENT.

@BaseMax
Copy link
Member Author

BaseMax commented May 27, 2021

For example this sample.

main {
    names = ['Hamza', 'Max', 'John']
    for name in names {
        println('Hello, $name')
    }
}

@BaseMax
Copy link
Member Author

BaseMax commented May 27, 2021

For example: We not should allow null, and need to keep null safety and check all null values at compile step.

C does not.
Rust does it.

@BaseMax
Copy link
Member Author

BaseMax commented May 27, 2021

Data Type

The data type must be precisely determinable.

i8 i16 i32 i64 u8 u16 u32 u64 f32 f64
string char , etc

For example:

  • i8 means: int 8 bit
  • u8 means unsigned int 8 bit

The char data type can store utf8 character. e.g: "ه"

If you want to develop system-level program and want to work with ASCII char. you can use int data type.
e.g at C: int c = 'A';


Auto Data Type

Did you see auto data type at Cpp?

one syntax:

varname = 5*4.1 (datatype will be float32 at default)

if you want, you can cast to float64:

f64 varname = 5*4.1

@BaseMax
Copy link
Member Author

BaseMax commented May 27, 2021

Function return value

Another point: we need ability to return multi values and variables in a single function. (Go has this feature as well)

i8, i16, u8 funcName {
  return -10, 1000, 5
}

or

funcName : i8, i16, u8 {
  return -10, 1000, 5
}

More clear:

funcName(arg1, arg2, arg3) : i8, i16, u8 {
  return -10, 1000, 5
}

@BaseMax
Copy link
Member Author

BaseMax commented May 27, 2021

OOP? yes or no?

What do you think?

I not think too much to deep features of OOP.
But I think a minimal features of OOP is good.
I think module/package idea is more better.

You can define a function public easily:

# this function can access from out of this package/program
pub func1 {
   # default: datatype of function is void
}

# this is only avaiable internaly and not out of this!
func2 {

}

@BaseMax
Copy link
Member Author

BaseMax commented May 27, 2021

GC

GC? I think RUST method is good for compiler languages.
I not sure so much.

Check this for Rust gc: https://stackoverflow.com/questions/32677420/what-does-rust-have-instead-of-a-garbage-collector

If you want more technically article about Rust gc: https://manishearth.github.io/blog/2021/04/05/a-tour-of-safe-tracing-gc-designs-in-rust/

rust inserts the clean up code at compile time. with c you write the clean up code yourself. with garbage collection clean up is figured out at runtine

https://www.reddit.com/r/rust/comments/b742vu/if_rust_has_no_garbage_collector_how_does_it/

i think it would be nice to have 2 levels beginner and advanced, because i hate in java that it does not allow explicit free memory

i will not leave sensitive data in memory thinking gc will clean that

Both expert user and new user? Good idea.

Yes, in most case that can easily free after ending that block.


golang have defer keyword for this.
This will execute command later.
usually developers use defer for threads or close opened file.

@BaseMax
Copy link
Member Author

BaseMax commented May 27, 2021

Multi Thread

We also want this. C++ have good functionality in this case. nice and clean syntax. (Not completely)

mutex and such things

JAVASCRIPT is the best support multi actions without threads

And finally await and async (JS)

@BaseMax BaseMax pinned this issue May 27, 2021
@abdorah
Copy link
Member

abdorah commented May 29, 2021

One Programming Language

  • One is an open source, self-hosted, bootstrapping, easy to build, reliable, and efficient system programming language. It is developed by Max and other open source contributors.
  • This project aims to create a compiler for One programming language. Our main principle is to keep it simple and achieve our goals of making One a system programming language capable of interacting with APIs and supporting web programming.

Definition & Features

A programming language should be easy, fun to learn, and rich in terms of features and funcionalies. Those are exactly the requirements that we are trying to acheive in One programming language project. Consequently, One programming language is
going to be :

  • Easy to use, with intuitive and clear syntaxe. Thus, these features will decrease bugs while developping a program.
  • A system-level programming language. Hence, it will be ideal for new programming learners. They can create command-line software, resolve programming problems, and process information from input and display the results.
  • An intermediate-level programming language. With the ability to generate byte-code, to compile it on every operating system, and then to build secure executable files / output from the program source. With runtime libraries that function in Windows, Linux, macOS as well.
  • Also, One programming language is going to have an interpreter to make it easy to interacte and test simple programs. In addition, a package manager is an importante feature to have it into our programming language.
  • A programming language that can interacte with web. That is why, it going to have a web framework. The key advantage of this framework is that we are going to need lesser languages and tools to create a website. Thus, the developement of the website is going to be by using only One programming language in same syntax.

In a nutshell

Feature One programming language
Easy and intuitive syntaxe [x]
Intermidiate level (ability to generate byte-code) [x]
System level (command-line tool) [x]
Simple interpreter [x]
Orginized package management [x]
Web framework [x]
Runtime libraries that function in Windows, Linux, and macOS. [x]

@BaseMax
Copy link
Member Author

BaseMax commented May 29, 2021

Thanks Kotbi.
Just some minor changes in my mind:

With the ability to generate byte-code, to compile it on every operating system

What do you means by byte-code?

Also, One programming language is going to have an interpreter to make it easy to interacte and test simple programs.

We are a compiler so we will not have an interpreter I think.

Just to make clear:

We going to generate an object-code and binary and finally an executable file. so it's not a virtual machine or byte-code like JVM/java. And we generate binary file such as C, Go, Rust, etc.
LLVM can help us in this case to generate object-code for every OS and every architecture, so can tell we are a really cross-platform compiler. Hooray!

@BaseMax
Copy link
Member Author

BaseMax commented May 29, 2021

We need to keep some features of script language in a compiler / system language. I am not talking about static variables, What I mean is more than that. Usually in script interpreter languages we have many good features and functions. But they are mostly lost in C.

Just to make clear above paragraphs:

For example, interpreter-like languages such as Python and PHP or Javascript, TypeScript... have some very good features some things missed at C.
We want to design them if they are possible and useful.

@n4i9kita n4i9kita removed their assignment May 29, 2021
@BaseMax
Copy link
Member Author

BaseMax commented May 29, 2021

It’s aim

I'm a programmer myself and see problems some things others face but they do not try to change.
It does not mean they cannot program right now, But we just want to do works in an easier way.

okay so the aim is to solving problems that every programmer face

We want to provide a new tool to write programs easier and better.

is one lang a compiler or interpreter?

"One language" will be a compiler.
Maybe one day we decide to have both compilers and interpreters
But right now I think the compiler is very good for us and it's enough for our purposes.

and what is the difference? (compiler vs interpreter)

The compiler means the ability to convert your human read-able source to machine code (object code) and finally an executable file.
So when I compile the source, A machine code will be generated.
And I think easily share the .exe file with you or any person.

And I do not have to share source code. and If I share .exe it's enough and you can run and use it from my program.

Interpreter means you need source code to run that. And interpreters parse and check source code at runtime. (read every character of your input file)

But compilers generate machine code at compile time. and at run-time, this just will execute and not need to parse or check something.

you should use additional libraries to convert .py files into .exe files

You can create a .exe with an internal python interpreter at .exe or use obfuscate code methods. But finally, it's not directly machine code.

Python unable to create a directly machine code. (I aware this days python can generate .pyc files, PYC is such as bytecode format and it's help python to works faster)

Maybe you use another project called Cython and this can convert python to C and finally create .exe via the c compiler and not python.

then python is an interpreter
that's why python can tell you when you do something wrong in real time. did i get it right?

Yes, interpreters have some features something missed at compilers.

we were talking about the aims of the project:

so we have:

  • solving problems that every programmer face.
  • providing a new tool to write programs in an easier and better way.

anything you want to add?


Also, We want to develop a new solution to design and create websites without learning many languages.

without the need to an third-party library?

Yes. But maybe we provide some internal libraries, But without the external library.

Currently, if you want to create a website, you have to learn HTML, CSS, JS, etc.

Just 3 different languages for the front-end, Still you need more for the back-end part.

do you mean "graphic design" or front-end/back-end processes?

I do not mean design, I talk about programming. so the front-end and the back-end.

We just want to help other developers to create the fast and maintainable programs in an easy way.

@BaseMax
Copy link
Member Author

BaseMax commented May 29, 2021

The situation and the difference we'll make

we are writing the situation and the difference we'll make
so, with one language
you can create executable programs and websites
normally you would need more than 3 different languages
right?

"THE SITUATION OF THE MARKET AND THE CHANGES THAT OUR LANGUAGE WILL CREATE."

The main purpose is to keep one language for the most need of the programmers.
Maybe it's a big goal but we are trying to help.

I mean "One" word.

do you want me to add this sentence to aims part?

You can if it's useful, But I know it's not possible to use one tool for everything.

For example, we not useful for android and mobile applications right now.

we can say it because you will continue to develop the language, right?

Yes sure.

and that can be something you will add in the future

Yup

we should compare to the situation

Currently one of the most popular programming languages is Python but it is not a compiler. So, you can't create executable files with its internal libraries.

or, If you want to create a website you will need 3 languages

I want to add:

Developers will able to write fast programs in less time and will need less time in the future to develop or maintain their programs.

In the first step, we only focus on the system and compiling the program to the executable files.

The ability to create a website is our second plan.

One Language lets you to create both executable programs and websites. Currently, to be able to do such operations, you need to know more than 3 different languages. So, One Language for all.
is not focused on any specific area, it’s a multi-purpose language.
will reduce the time needed to write, to develop or to maintain programs.

@BaseMax
Copy link
Member Author

BaseMax commented May 29, 2021

DESIGN AND DEVELOPMENT GOALS

I am not sure what's different from this subject to above.

the previous one was about what we will change
what the one language will do in a different way
and it will be used like a introduction
here, we are going to say everything we plan to do without talking about other languages

  • Clean and easy syntax
  • General-purpose
  • Useful functionality and runtime-library
  • Bootstrapping and self-host compiler
  • Ability to create the executable file
  • Cross-platform and support different architecture and OS
  • With an internal web-development framework
  • Fast performance while having clean syntax (A compiler with some useful features of interpreters)
  • Static-type language, but this can auto-detect the data type of your variable and values.
  • Debugging is much matter: The clean syntax for readers of code and not only focus on the writer (Refer to recent research: We mostly spend time to read and debug and not write new code) / Some features to help programmers maintenance easier
  • Modular system (A clean and nice structure of modules) with a friendly package manager (easily install the third-party library, in just one command at all OS, That never happened at C or Cpp)
  • so?

@BaseMax
Copy link
Member Author

BaseMax commented May 29, 2021

FEATURES OF THE LANGUAGE

the next part is "FEATURES OF THE LANGUAGE" but we can skip this one
we explained almost everything.

we can write the features that one language already has to "FEATURES OF THE LANGUAGE" part
and the thing that you are planning to add to "DESIGN AND DEVELOPMENT GOALS"
should we go that way
or just delete "FEATURES OF THE LANGUAGE"

But our project is still at the alpha version and all features are currently not stable and ready.

We did some different versions of compilers, But right now we are rewriting the whole beginning Since we have to keep the project clean.

@BaseMax
Copy link
Member Author

BaseMax commented May 29, 2021

our next topic is "DESIGN DECISIONS"

I not sure what I have to say. :)

  • Modules may be referred to each other and depend on other modules.
  • Programmer is able to split a program into different parts into separate files.

anything else?

If we go deeper, this will be long.

We can talk about everything.

For example, In One language you can define the data type of variable, and also you can leave it. Since the compiler can auto-detect data-type of your value.
But if you want to cast value or keep it stable, you can define the data type of your variable. (For example age variable is always number and cannot never be other data-types)

@BaseMax
Copy link
Member Author

BaseMax commented May 29, 2021

"run-time system choice"

At runtime, we do not have NULL and our language is null-safety.
So you can make sure everything works at runtime, Since you passed so many errors at compile step :)

About run-time, currently, we will use Glibc and programmers allow to use and link this. Because all of the computer library needs this. (pthread, libcurl, libopenssl, mysql/mariadb database, etc)
But We have plan to also able to generate executable file without needing to C library (Glibc), We did this before and able to do this.

At old: we generated C-intermediate code and used a C compiler to generate an executable file in the background of the compiler.

But Currently, At first step of the project, we use LLVM as the back-end of the compiler. so we are able to generate object-file and executable files for every OS and architecture.

And so, One compiled programs are mostly optimized with great performance.

@BaseMax
Copy link
Member Author

BaseMax commented May 29, 2021

LIBRARY

The topic we are going to write now is "LIBRARY"

now we are going to speak about "library" like core library, optional modules
will onelangueage support commonly used libraries? etc.

We will have a module/package store to list all of One package and users able to see a list of popular and most downloaded packages, most used packages, recently updated packages, etc.

Everyone allow to create and publish a package, we will have a check team to review all packages.

But we will flag great and useful libraries.
So when a package flagged by our team, we will support and manage bugs and probably issues.

Supports LibCurl, OpenSSL, Tensorflow(?), OpenCV(?)...

Yes, we need to support third-party libraries step by step, and adding these, and design an intermediate interface to connect to the main library.

For example, we need to use databases. e.g: MySQL/MariaDB
so we will add this support library to one language at first.
OpenCV and others maybe not be the first target.

@BaseMax
Copy link
Member Author

BaseMax commented May 29, 2021

Interoperability

direct C interface

@BaseMax
Copy link
Member Author

BaseMax commented May 29, 2021

supported platforms

next one and the last one is
"supported platforms"

One Language for ALL!

In order of priority:

  • Linux
  • Windows
  • macOS
  • BSD family

would you want to add:
and mobile platforms in future!

Yes, but not now.

@basalumutgazi
Copy link
Member

basalumutgazi commented May 29, 2021

You can also see my notes here.
Please note that this is not the latest version of the mission statemen. These are just ideas we've put together with @BaseMax. The Mission Statement will be written later based on these ideas.

THE MISSION STATEMENT OF THE ONE PROGRAMMING LANGUAGE

THE SITUATION OF THE MARKET AND THE CHANGES THAT OUR LANGUAGE WILL CREATE.
One Language lets you to create both executable programs and websites. Currently, to be able to do such operations, you need to know more than 3 different languages. So, One Language for all.
is not focused on any specific area, it’s a multi-purpose language.
will reduce the time needed to write, to develop or to maintain programs.

IT’S AIM

solving problems that every programmer face.

providing a new tool to write programs in an easier and better way.

developing a new solution to design and to create websites without learning many languages.

our main purpose is to provide one language for every need of the programmers.

DESIGN AND DEVELOPMENT GOALS

  • Clean and easy syntax
  • General-purpose
  • Useful functionality and runtime-library
  • Bootstrapping and self-host compiler
  • Ability to create the executable files
  • Cross-platform and support different architecture and OS
  • An internal web-development framework
  • Debugging is much matter: The clean syntax for readers of code and not only focus on the writer ( Refer to recent research: We mostly spend time to read and debug and not write new code) / Some features to help programmers maintenance easier
  • Static-type language, but this can auto-detect the data type of your variable and values
  • Fast performance while having clean syntax (A compiler with some features of interpreters)
  • Modular system (A clean and nice structure of modules) with a friendly package manager (easily install third-party library, in just one command at all OS, that was never happened at C or Cpp)

FEATURES OF THE LANGUAGE

The project is still at alpha version.

DESIGN DECISIONS

  • Modules may be referred to each other and depend on other modules.
  • Programmer is able to split a program into different parts / into separate files.

RUN-TIME SYSTEM CHOICE

At runtime, we do not have NULL and our language is null-safety. So you can make sure everything works at runtime, Since you passed so many errors at compile step :)

About run-time, currently, we will use Glibc and programmers allow to use and link this. Because all of the computer library needs this. (pthread, libcurl, libopenssl, mysql/mariadb database, etc) But We have plan to also able to generate executable file without needing to C library (Glibc), We did this before and able to do this.

At old: we generated C-intermediate code and used a C compiler to generate an executable file in the background of the compiler. But Currently, At first step of the project, we use LLVM as the back-end of the compiler. so we are able to generate object-file and executable files for every OS and architecture. And so, One compiled programs are mostly optimized with great performance.

LIBRARY

We will have a module/package store to list all of One package and users able to see a list of popular and most downloaded packages, most used packages, recently updated packages, etc.

Everyone allow to create and publish a package, we will have a check team to review all packages. But we will flag great and useful libraries. So when a package flagged by our team, we will support and manage bugs and probably issues.

We will support third-part libraries in future.

INTEROPERABILITY

  • Direct C Interface

SUPPORTED PLATFORMS

  • Linux
  • Windows
  • macOS
  • BSD family

@BaseMax
Copy link
Member Author

BaseMax commented May 29, 2021

Syntax suggestion from a friend, dear Amin:

# patterns

keywords =		'[a-z]+'
annotation =	'[a-z]+'

variables =		'[a-zA-Z_][a-zA-Z_0-9]*'
types =			'[a-zA-Z_][a-zA-Z_0-9]*'
labels =		'[a-zA-Z_][a-zA-Z_0-9]*'

# built-in type names:
	int, float
	char, string
	boolean

# built-in types:
	char                    'a'
	int                     1, 0x01, 0b01, 01
	float                   1.0
	string                  "Hello"
	array					[]
	boolean					T, F
	null					N
	function				def (a, b) => a + b

# string kinds:

raw string: use 'r' before strings
	r"hello \" world" -> hello " world
	r"hello \\ world" -> hello \ world

formated string: use 'f' before strings
	var name = "World"
	f"Hello {name}!" -> "Hello World!"

multi-line strings:
        a = "\
    hello, I'm here to answer you.
    "

math operations:
	+		add					%		mod
	-		sub					**		exp
	*		mul
	/		div

	==		equal				!=		not equal
	<		less than			<=		less than equal
	>		greater than		>=		greater than equal

	&		bitwisze and		and		logic and
	|		bitwisze or			or 		logic or
	^		bitwisze xor		xor		logic xor
	~		bitwisze not		not		logic not

	<<		shift left
	>>		shift right

	+=		add assign			%=		mod assign
	-=		sub assign			**=		exp assign
	*=		mul	assign
	/=		div assign

	&=		bit and assign		and=	logic and assign
	|=		bit or assign		or=		logic or assign
	^=		bit xor assign		xor=	logic xor assign

	<<=		shift left assign
	>>=		shift right assign

## true division and normal division
any = int or float

# python
	any		/		any 	=> float

	int 	//		int 	=> int

	float 	//		int 	=> float
	int 	//		float 	=> float
	float 	//		float 	=> float

# lesscript
	int		/		int 	=> int
	int		%		int		=> int

	float 	/		float	=> float
	float	%		float	=> float


## built-in types operation:

var array = [1, 2, 3]
var length = array.length
var item = array[2]
var new_array = array[0:-1]                 # new_array == [1, 2]

var string = "Hello"
var length = string.length
var item = string[5]                        # item ?= char
var new_string = string[::-1]               # new_string == "olleH"

# built-in types functions:

def int.is_natural() = (self > 0)

def string.is_lower()
	for ch in self
		if ! ('a' <= ch <= 'z')
			return false
		end
	end
	return true
end

# annotation definition:

@public
val a = 10

@private
val b = 30

# type definitions:

type number = int
type numbers = int[]

type unsigned -> (self ?= int) && (self >= 0)
type signed -> (self ?= int)


def max_uint(bits: int) => 2 ** bits
def min_uint(bits: int) => 0

def max_int(bits: int) => 2 ** (bits - 1) - 1
def min_int(bits: int) => -(2 ** (bits - 1))


type uint(bits: int) -> (self match int) and \-
	(min_uint(bits) <= self <= max_uint(bits))

type uint(bits: int or none = N)
	return (self not match int) ? FALSE :
		((bits != NONE) ? TRUE : 
			min_uint(bits) <= max_uint ))
end

temp <bits: int, signed: bool>
def new_func(hello: int(bits, unsigned)): int(128, FALSE)
	return hello + 100
end

type u8: uint(8)
type u16: uint(16)
type u32: uint(32)
type u64: uint(64)
type u128: uint(128)

type i8: int(8)
type i16: int(16)
type i32: int(32)
type i64: int(64)
type i128: int(128)


type int_limit(min: int, max: int)
	return (self ?= int) && (self >= min) && (self <= max)
end

var a: unsigned = 100
var b: int_limit(100, 200) = 150

# type definition examples:

	int[]					[1, 2, 3, 4]		; array of ints
	int[3]					[1, 2, 3]			; array of three ints
	[int, int]				[1, 2]				; array of two ints

	{x: int, y: int}		{10, 20}			; dict of two ints
	{name, age}				{"Jack", 20}		; dict of a name and an age

	null or string			N					; a null or string
	null or int				10					; a null or int
	(int or string)[2]		[1, "Hi"]			; array of int or string with
												; size of 2
	(null or int)[2..10]	[N, 30]				; array of int or null with
												; minimum, maximum size of
												; 0, 10

# dict:

it's a type.

dict Person
	name: string or null
	age: int

	def hello(name = N)
		name = (name == N) ? f" {name}," : ","
		print(f"Hello {name}, my name is {self.name}")
	end

	def $()
		return "Person({}, {})" % (name, age)
	end
end

val persons = [val 1, val 2]

var me = new Person("Amin", 20)

persons.hello()

# class:

class Person
	val name: string
	val age: int

	def Person (name: string, age: int)
		self.name = name
		self.age = age
	end

	def greeting (name: string or null = N)
		if name == N
			printf("Hello, my name is {}.", self.name)
		else
			printf("Hello {}, my name is {}.", name, self.name)
		end
	end
end

# interface:

interface Person
	def get_name(): string
	def get_age(): int
end

val persons = [
	new Person("Amin", 21),
	new Person("Armin", 17),
	]

val me: Person = new Person("Amin", 21)
me.greeting("Armin")

class ConstPoint
	val x
	val y

	def Point(var x, var y)
		self.x = x
		self.y = y
	end
end

class Point extends ConstPoint
	var x
	var y

	def add(val a)
		self.x += a
		self.y += a
	end

	def add(val x, val y)
		self.x += x
		self.y += y
	end

	def sub(val a)
		self.x -= a
		self.y -= a
	end
end

# structure:

struct Point
	x: int
	y: int

	def add (point: Point)
		self.x += point.x
		self.y += point.y
	end

	def distance (point: Point)
		return ((self.x - point.x) ** 2 + (self.y - point.y) ** 2) ** (1 / 2)
	end

	def +(other: Point or int): Point
		if other ?= Point
			return {self.x + other.x, self.y + other.y}
		else if other ?= int
			return {self.x + other}
		end
	end

	def -(other: Point or int)
		if other ?= Point
			return {self.x - other.x, self.y - other.y}
		else if other ?= int
			return {self.x - other}
		end
	end
end

var points = [
	new Point {x = 10, y = 20},
	new Point {x = 30, y = 40},
	]

## control flow:

# goto

label LABEL
goto LABEL

# if

if COND
	STATEMENT
if COND
	STATEMENT
else if COND
	STATEMENT
else
	STATEMENT
end

if COND then STATEMENT

if COND goto LABEL

# loop

repeat VALUE
	STATEMENT
end

repeat VALUE do STATEMENT

# for 3 part

for INIT; TEST; STEP
	STATEMENT
else
	STATEMENT
end

for INIT; TEST; STEP do STATEMENT

# for iterable

for NAME in ITER
	STATEMENT
else
	STATEMENT
end

for NAME in ITER do STATEMENT

# while

while COND
	STATEMENT
else
	STATEMENT
end

while COND do STATEMENT

# no do while

# switch

switch VALUE
	case VALUE
		STATEMENT
		break

	case VALUE
		STATEMENT
		break

	case VALUE
		STATEMENT
		break

	default
		STATEMENT
		break
end


### functions error handling

# Rust

let f = match f {
	Ok(file) => file,
	Error(error) => panic!("Problem openning file: {:?}", error),
};

# Lesscript

type IpAddrV4 = [int, int, int, int]
type IpAddrV6 = [int, int, int, int, int, int]
type IpAddr = IpAddrV4 or IpAddrV6
type Error = int

def get_ip() -> IpAddr or Error
	if SOME_ERRORS
		return 10
	end
	if RETURN_V4;
		then return [10, 20, 30, 40]
	return [10, 20, 30, 40, 50, 60]
end


ip = get_ip()
if ip of IpAddr
	statement_A
end

if ip of Error
	statement_B
end

@abdorah
Copy link
Member

abdorah commented May 30, 2021

One Programming Language

  • One is an open-source, self-hosted, bootstrapping, easy to build, reliable, and efficient system programming language. It is developed by @BaseMax and other open-source contributors.
  • This project aims to create a compiler for One programming language. Our main principle is to keep it simple and achieve our goals of making One a system programming language capable of interacting with APIs and supporting web programming.

Definition & Features

A programming language should be easy, fun to learn, and rich in terms of features and functionalities. Those are exactly the requirements that we are trying to achieve in the One programming language project. Consequently, One programming language is
going to be :

  • Easy to use, with intuitive and clear syntax. Thus, these features will decrease bugs while developing a program.
  • A system-level programming language. Hence, it will be ideal for new programming learners. They can create command-line software, resolve programming problems, and process information from input and display the results.
  • With the ability to compile the source code on Windows, Linux, and macOS. This can be achieved using LLVM to generate object-code for every OS and every architecture. Because our goal is to make One compiler really cross-platform compiler. Finally, a developer can build secure executable files/output from the program source. In addition to runtime libraries that function in Windows, Linux, macOS as well.
  • One programming language will have a package manager which is an important feature to have in our programming language.
  • A programming language that can interact with the web. That is why it going to have a web framework. The key advantage of this framework is that we are going to need lesser languages and tools to create a website. Thus, the development of the website is going to be by using only One programming language in the same syntax.
  • Finally, is One programming language trying to bring in the awesome features of interpreter-like languages such as Python and PHP or Javascript, TypeScript, etc. Those that are missed in C.

In a nutshell

Feature One programming language
Easy and intuitive syntaxe ✔️
Cross platforms (ability to generate object-code) ✔️
System level (command-line tool) ✔️
Orginized package management ✔️
Web framework ✔️
Runtime libraries that function in Windows, Linux, and macOS. ✔️

@basalumutgazi
Copy link
Member

Here is the final version of the Mission Statement.

THE MISSION STATEMENT of the One Language

One Language for all

In today’s world, there are so many programming languages, and each of them is used for different purposes. If you need executable programs, scripts, and websites for your project, to be able to do all these operations, you need more than 3 different languages.

The One language will be a game-changer because it is not focused on any specific area, it’s a multi-purpose language. It will serve all your needs, and become your only need.

OUR AIM

The One language project aims at reducing the time needed for writing, developing, or maintaining programs.

During the process of writing codes, every programmer faces some common problems but they do not think of solving these problems but they try to get used to them. We, the One language developing team, want to put an end to this. Our aim is to solve all these problems and to present you a smooth developing experience.

The One Language aims to provide you a new tool to write programs in an easier and better way.

Developing a brand-new solution to the design and creation processes of websites, without the need of learning different languages is one of our intentions.

In short, the main purpose of One Language is to provide programmers a single language for all of their needs and also making their lives easier.

DESIGN AND DEVELOPMENT GOALS

The One Language development team is planning to reach the aims of the project by achieving these goals:

  • Clean and easy syntax
  • Multi-purpose language
  • Useful functionality and runtime-library
  • Bootstrapping and self-host compiler
  • Ability to create executable files
  • Cross-platform compatibility
  • Support for different architectures and OSs
  • An internal web-development framework
  • Easier debugging: Programmers mostly spend their time on reading and debugging their code and not on writing (you can see a discussion about this subject here)
  • Easier maintenance
  • Static-type language (but it can auto-detect the type of your variables and values)
  • Faster performance
  • A compiler that also has some of the features of interpreters
  • Modular system (a clean and nice structure of modules)
  • A friendly package manager (easily installing third-party libraries, with just one single command)

FEATURES OF THE LANGUAGE

The project is still in Alpha. TO BE UPDATED.

DESIGN DECISIONS

  • Modules referable to each other and dependable on other modules
  • Ability to split a program into different parts / into separate files

RUN-TIME SYSTEM CHOICE

At runtime, One doesn’t have NULL, and the language supports null safety. So you can make sure everything works at runtime, as you have already passed so many errors at compiling step.

Currently, we use Glibc, and programmers are allowed to use and link it, because all of the libraries need Glibc. (pthread, libcurl, libopenssl, mysql/mariadb database, etc.) Yet, we are also planning to be able to generate executable files without the need for C library (Glibc). We tried this before, and we were able to do it.
We generated C-intermediate code and used a C compiler to generate an executable file at the background of the compiler, but for the time being, at these first steps of the project, we use LLVM for the back-end of the compiler. So, we can generate object-file and executable files for every OS and architecture. In the future, we will have our own runtime library. Furthermore, programs compiled by One are mostly optimized with great performance.

LIBRARY

The One language will have a module/package marketplace to list all of the packages compatible with One, and users will be able to see the lists of packages such as the most popular, the most downloaded, or recently updated packages.

Everyone will be allowed to create and publish packages. We will have a quality control team to review all packages, and we will flag the great and useful ones. If your package is flagged by our team, you will have our support to manage the bugs and probably the issues.

Support for third-party libraries is also among our future plans.

INTEROPERABILITY

  • Direct C Interface

SUPPORTED PLATFORMS

  • Linux
  • Windows
  • macOS
  • BSD family

Mission-statement.md

@jbampton jbampton added Good First Issue Good for newcomers Help Wanted Extra attention is needed Question Further information is requested labels Jun 5, 2021
@jbampton jbampton changed the title Write a draft for Mission Statement of The One Programming Language 🕴️ Write a draft for Mission Statement of The One Programming Language🕴️ Jun 5, 2021
@n4i9kita n4i9kita removed their assignment Jun 5, 2021
@async-costelo async-costelo removed their assignment Jun 5, 2021
@Majalian
Copy link
Contributor

Majalian commented Jul 19, 2021

MISSION STATEMENT

“One offers a unique design experience for programmers around the world, by providing creative, ingenious, and innovative solutions, it’s time for One programming language for all!”

VISION STATEMENT

“Compile and Unite with One Language”

ONE

The best cost-efficient, fast and reliable language did not exist until now, with One language it is undeniable that you will reduce the cost of building software creatively and innovatively!
How? With One, which compiles plenty of languages in just one, the amount of work and the process of hiring multiple programmers specialized in different languages will be reduced drastically, your only need will be a One Language expert to carry on your work!
A game-changer and a revolution in the world of programming has emerged, with this multi-purpose language, the amount of time, money, manpower, and maintenance is set to a limit under your budget, guaranteed!

PURPOSE

The One Language aims to introduce the ultimate solution to your time and cost barriers to achieve your goals faster efficiently and creatively.
Coding can be challenging when faced with issues that are often called “unsolvable” and it became common practice to overlook these issues and carry on working as if they were part of the coding process, which most programmers fall for and never try to fix.
With ONE, the developing team has solved the unsolvable and carried on without leaving any issues behind. With new tools that can enable coding to become easier and more reliable than before.

DESIGN AND DEVELOPMENT GOALS

The One Language development team is on its way to achieving the following:

  • Clean and easy syntax
  • Multi-purpose language
  • Useful functionality and runtime-library
  • Bootstrapping and self-host compiler
  • Ability to create executable files
  • Cross-platform compatibility
  • Support for different architectures and OSs
  • An internal web-development framework
  • Easier debugging: Programmers mostly spend their time on reading and debugging their code, which is a time wasted at the expense of writing the actual codes (you can see a discussion about this subject here)
  • Easier maintenance
  • Static-type language (but it can auto-detect the type of your variables and values)
  • Faster performance
  • A compiler that also has some features of interpreters
  • Modular system (a clean and nice structure of modules)
  • A friendly package manager (easily installing third-party libraries, with just one single command)

FEATURES OF THE LANGUAGE

The project is still in the Alpha phase. And to be updated

DESIGN DECISIONS

Modules referable to each other and dependable on other modules
Ability to split a program into different parts / into separate files

RUN-TIME SYSTEM CHOICE

At runtime, ONE doesn’t NULL, and the language supports null safety. So, you can make sure everything works at runtime, as you have already passed so many errors in compiling step.
Currently, Glibc is being used, and programmers are allowed to be used and linked since all libraries need Glibc. (pthread, libcurl, libopenssl, mysql/mariadb database, etc.) Yet, we are also planning to be able to generate executable files without the need for a C library (Glibc).
We generated C-intermediate code and used a C compiler to generate an executable file at the background of the compiler, but for the time being, at its early steps, we use LLVM for the back-end of the compiler. So, we can generate object-file and executable files for every OS and architecture. In the future, we will have our runtime library. Furthermore, programs compiled by One are mostly optimized with great performance.

LIBRARY

The One Language will have a module/package marketplace to list all the packages compatible with One, and users will be able to see the lists of packages such as the most popular, the most downloaded, or recently updated packages.
Everyone will be allowed to create and publish packages. We will have a quality control team to review all packages, and we will flag the usable ones. If your package is flagged by our team, you will have our support to manage the bugs and probably the issues.
Support for third-party libraries is also among our plans.

INTEROPERABILITY

Direct C Interface

SUPPORTED PLATFORMS

Linux
Windows
macOS
BSD family

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Enhancement New feature or request Good First Issue Good for newcomers hacktoberfest Help Wanted Extra attention is needed Question Further information is requested
Projects
None yet
Development

No branches or pull requests

10 participants