Create License and update README.md

This commit is contained in:
apio 2022-08-25 20:37:50 +02:00
parent ef6a993fde
commit 7094698df7
2 changed files with 16 additions and 4 deletions

9
LICENSE Normal file
View File

@ -0,0 +1,9 @@
Copyright 2022, the Sapphire developers
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,7 +1,7 @@
# Sapphire # Sapphire
A modern, fast and reliable programming language. (WIP) A modern, fast and reliable programming language. (WIP)
**WARNING**: Most features in this README (especially the About section) are planned for the future and not yet implemented. **WARNING**: The About, Basic usage and Examples sections are planned for the future and not yet implemented. They are just sections that describe what is planned for Sapphire for the future, since at the moment there are not many features to describe.
## About ## About
Sapphire is a relatively high-level programming language, yet low-level when it needs to be. The language supports low-level memory manipulation using pointers, but pointer arithmetic is only allowed in unsafe contexts, for greater memory safety. Dynamic memory allocation is also a thing, though it is recommended not to use it directly, but instead make great use of [smart pointers](https://en.wikipedia.org/wiki/Smart_pointer). Sapphire is a relatively high-level programming language, yet low-level when it needs to be. The language supports low-level memory manipulation using pointers, but pointer arithmetic is only allowed in unsafe contexts, for greater memory safety. Dynamic memory allocation is also a thing, though it is recommended not to use it directly, but instead make great use of [smart pointers](https://en.wikipedia.org/wiki/Smart_pointer).
@ -113,7 +113,7 @@ In that case, symlink ninja-build to ninja (`ln -s /usr/bin/ninja /usr/bin/ninja
First-time setup: First-time setup:
``` ```
./sapphire.sh generate <build system, such as Ninja or Unix Makefiles (you can view all possible options with `cmake --help`)> <build type: Debug or Release (or MinSizeRel/RelWithDebInfo)> ./sapphire.sh generate <build system, such as Ninja or Unix Makefiles (you can view all possible options with cmake --help)> <build type: Debug or Release (or MinSizeRel/RelWithDebInfo)>
``` ```
To change build type/build system, just run `./sapphire.sh clean` followed by the generate command above. To change build type/build system, just run `./sapphire.sh clean` followed by the generate command above.
@ -135,7 +135,7 @@ The compiler is built at `build/sapphirec`.
For now, it can only generate object files/LLVM IR, so you'll have to link manually. For now, it can only generate object files/LLVM IR, so you'll have to link manually.
A few example commands: A few example commands:
``` ```sh
$ build/sapphirec --version # prints the compiler version $ build/sapphirec --version # prints the compiler version
$ build/sapphirec --help # shows usage $ build/sapphirec --help # shows usage
$ build/sapphirec main.sp # compiles a file $ build/sapphirec main.sp # compiles a file
@ -143,4 +143,7 @@ $ build/sapphirec main.sp -o main.o # compiles a file with output filename
$ build/sapphirec main.sp -o main.o --msystem darwin # compiles a file for macOS $ build/sapphirec main.sp -o main.o --msystem darwin # compiles a file for macOS
$ build/sapphirec main.sp -o main.o && gcc main.o -o main && ./main # compiles, links and runs $ build/sapphirec main.sp -o main.o && gcc main.o -o main && ./main # compiles, links and runs
$ build/sapphirec main.sp -o main.ll --emit-llvm # display the generated cross-platform LLVM intermediate representation $ build/sapphirec main.sp -o main.ll --emit-llvm # display the generated cross-platform LLVM intermediate representation
``` ```
## License
[BSD-2](https://opensource.org/licenses/BSD-2-Clause), since that's my favorite license :). See [LICENSE](LICENSE).