- Notifications
You must be signed in to change notification settings - Fork1
Compiler to generate C Code and executable with many features and syntax sugger
License
AmrDeveloper/Done
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Toy Compiler Project that generate C code
Done support most of C Features like struct, enum, pointer, address and can use any C libraryand also have some new features from other languages like single line function and Elvis operatorand can separate number with _ for example 1_000_000
Code Example
Utils.done
fun isOdd(x : int) : bool -> return x%2 == 0;fun isEvent(x : int) : bool -> return x%2 != 0;Main.done
// Import File written in Done Languageimport { "Utils"}// Include C Standard Librariesinclude { "stdio"}fun main() : int { printf("Enter your number : "); var number : int; scanf("%d", &number); if(isEvent(number)) { printf("Even Number"); }else{ printf("Odd Number"); } return 0;}To compile this code you should write
donec Main.done -xNow you will see main.c and main.exe if you using Windows OS,
To run the executable
./main- Compiler OptionsTo the compiler name gcc or clang
-c gccTo set the optimization level
-o O3To set the C generated file name
-g main.cTo set the executable file name
-e mainTo enable generating executable
-xTo generate and run executable
-rTo print the donec version
-vTo Print the help menu
-hVideo Example :Youtube
License
MIT LicenseCopyright (c) 2020 Amr HeshamPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.About
Compiler to generate C Code and executable with many features and syntax sugger
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.