Hoping to make it transpile to C code and self-compiling the compiler. The first version of the compiler might be written in Kotlin.
Created
December 10, 2017 01:58
-
-
Save aziis98/6bd707987acf59a051d43bfb5d64c931 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Bind symbols with values with the := operator | |
| first person := "Immanuel Kant" | |
| # Bindings can also use parameters | |
| great ( name ) := | |
| print line ( join ( "Hello, " name "!" ) ) | |
| # Spaces everywere! | |
| great ( first person ) | |
| # Nested call | |
| great ( join ( "aziis" 98 ) ) | |
| # An example of a class/struct/... | |
| compound Person ( name, age, address ) | |
| # Creating the object | |
| person 1 := Person ( "Antonio" 19 "Pisa" ) | |
| # Accessing properties | |
| great ( person 1 > name ) | |
| great ( person ) with ( salute ) := | |
| print line ( join ( | |
| salute | |
| ", " | |
| person > name | |
| "!" | |
| ) ) | |
| great ( person 1 ) with ( "Ciao" ) | |
| compound Node ( value, next node ) | |
| compound LinkedList ( head ) | |
| # #define GET(type, value, prop_name) (((type*) value)->prop_name) | |
| ( list : LinkedList ) > push top ( value ) := | |
| # Node* new_node = malloc(sizeof(Node)); | |
| # new_node->value = value; | |
| # new_node->next_node = GET(LinkedList, list, head); | |
| new node := Node ( value, list > head ) | |
| # GET(LinkedList, list, head) = new_node | |
| list > head := new node | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment