50 lines
2.8 KiB
Markdown
50 lines
2.8 KiB
Markdown
# Basic outline of the Lang
|
|
In this document is a simple and basic outline of how to use the lang, along with an Index of everything in the documentation and a small description of it.
|
|
## Hello World!
|
|
Here's a simple hello world:
|
|
```java
|
|
include <io> // This is where all basic I/O functions live
|
|
|
|
! Main Function
|
|
public static void main() { // Declare a function the exact same way as in java, does not HAVE to be public nor static, these are automatic
|
|
io.println("Hi world!"); // Println works the same as its java counterpart
|
|
return; // Return is not needed for void functions, but can still be used.
|
|
}
|
|
// Note, syntax highlighting here will not be great, as this is a custom lang markdown does not have support for it! So i'm just using the java syntax highlighter... lol
|
|
```
|
|
You'll notice the syntax is similar to that of Java, minus having to declare the class of course. As here theres no classes *just files* so no, you cannot have classes in classes... or can you? No, no you cannot.
|
|
They're useful, but honestly i dislike them and find it makes things messy. (yes i like to have 3000 files how'd you know.)
|
|
|
|
Anyhow, Comments are the same as in C or Java, you can annotate a function to say its use via ! \[USAGE\] it basically just works like a comment, but is designed specifically for saying what a function does and can only be used before a function declaration. Going on with similarities, include carries over from C, except you do not need to add a file extension ***ever*** similar to how imports in java work, tho differing from that as there is *no* static imports.
|
|
So like shown in the example to use something like println from the io package, you must type `io.println("");` and not `println("");` if something is inside the same file you do not need the package before it, but you can still do this it won't hurt anything.
|
|
|
|
### Compact Source File Hello World
|
|
Compact source files are... interesting? don't know how to put it other than that.
|
|
```java
|
|
include <io>
|
|
|
|
io.println("Hellord"); // Print Hellord!
|
|
return 0; // MUST Have a return value!
|
|
```
|
|
It MUST return an int, cannot take in any arguments and is just... shitty? but its nice for just shoving down some crap.
|
|
|
|
Basically its the exact same as this, just shorter and easier to write. Also has drawbacks... major ones! Like not being able to define functions within the compact file... of course.
|
|
```java
|
|
include <io>
|
|
|
|
int main() {
|
|
io.println("Hellord");
|
|
return 0;
|
|
}
|
|
```
|
|
|
|
## Some Goals
|
|
This section is just random goals with the lang ngl its a lot of bullshit
|
|
|
|
### 1. Memory Safety
|
|
Yes i know this is like... a major thing in everything now? i dunno... i just think its a good thing, though rust is aids cancer hell with its syntax imo. I much prefer Java or C syntax.
|
|
|
|
## Index Of The Documentation:
|
|
1. [Basic input and Output with the IO Package](./IO.md)
|
|
2. [File IO](./FIO.md)
|
|
3. [OS Package](./OS.md) |