https://github.com/chaoticsomeone/uranium_lang
Uranium Lang: A Python and C++ based and (probably) unstable programming language
https://github.com/chaoticsomeone/uranium_lang
cpp cpp20 programming-language python python3 source-to-source-compiler transcompiler uranium-lang
Last synced: 6 months ago
JSON representation
Uranium Lang: A Python and C++ based and (probably) unstable programming language
- Host: GitHub
- URL: https://github.com/chaoticsomeone/uranium_lang
- Owner: ChaoticSomeone
- License: mit
- Created: 2023-09-07T11:48:01.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-02-04T17:37:21.000Z (about 1 year ago)
- Last Synced: 2024-02-05T11:23:08.514Z (about 1 year ago)
- Topics: cpp, cpp20, programming-language, python, python3, source-to-source-compiler, transcompiler, uranium-lang
- Language: Python
- Homepage:
- Size: 72.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Uranium Lang
**This is an open-source project, feel free to contribute**
# Uranium Lang - Features & Syntax
## Variables
### Primitive Datatypes:
- int
- float
- string
- bool### Decleration and Assignment
```
// decleration (doesn't work at the moment)
name: datatype// assignment
name: datatype = value
```Example:
```
number: int = 0
```## The main function
```
func main() -> int {
return 0
}
```## Functions
```
func name(param_name: param_type, ...) -> return_type {
// your code goes here
}
```Example:
```
func add(a: int, b: int) -> int {
return a + b
}
```**Please Note: Functions cannot be called yet (I might have fixed this already)**
## Comments
As of right now Uranium Lang only has support for single-line comments, multi-line comments will be added in the future.
```
// This is a single-line comment
```## If, Else if, Else
```
if condition1 {
...
} else if condition2 {
...
} else {
...
}
```Example:
```
num: int = 10
if num < 5 {
// do something here
} else if num > 5 {
// do something else here
} else {
// do something here too
}
```## While loops
```
while condition {
...
}
```Example:
```
num: int = 0
while i < 10 {
i = i +1
}
```## For loops
Uranium Lang will support different types of for-loops, however only the
classic iterative for-loop is implemented right now.
```
for name: datatype = value, condition, de/- incrementation value {
...
}
```Example:
```
for i: int = 0, i < 10, 1 {
// this achieves the same as the above while loop example
}
```# Uranium Lang - How does it work
The Uranium Compiler "runs through" your source code and tokenizes it. The resulting tokens are then
rearranged and resstructured so that they can be translated to C++ more easily.
Yes, Uranium Lang is not directly compiled to machine code, it gets compiled into C++ and
relies on an external C++ Compiler to do the rest of the compilation.## Importance of XML
Uranium Lang depends on various XML files, such as the ones for token generation,
the new parser also heavily relies on them. The reason for that? Customization!
Don't like a feature of the language? Just change the right XML file appropriately
and you can tailor it to your liking! Is this feature a good idea? Probably not,
but it stays nevertheless.