Skip to content

raybarrera/florence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Florence Programming Language

Toy language developed using Go's lexer/parser/ast/SSA/compiler as a basis

Basic program

:: Program main

fn main() {
    a := 1 + 2
    print(a) // 3
}

Types

Struct

type Foo struct {}

Attaching a method to a struct

By value
Foo :: fn Do(){}

Invoking the method

fn main() {
    foo := Foo{}
    foo.Do()
}
Using the it keyword
Foo :: fn Do() {
    print(it) // "it" refers to the copy of "Foo" passed into this method.
}
By pointer/ref
*Bar :: fn Do(){}
Using the it keyword with the @ dereference operator
type Bar struct {
    int fps
}

*Bar :: fn Do(){
    // Read as "the val at (@) 'it' (where 'it' is a pointer of type Bar)"
    @it.fps = 60

    ...

    it.fps = 60 // Compile error. A pointer of type Bar does not have a field named "fps"

}

About

Florence programming language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages