still mess, probably obsolete anyways
This commit is contained in:
8
example/begin.sex
Normal file
8
example/begin.sex
Normal file
@@ -0,0 +1,8 @@
|
||||
(pub fn void other-fn ()
|
||||
(begin (while true (begin 1 2 3 4)))
|
||||
(switch a
|
||||
((1) (begin
|
||||
(var (const char *) str "121232132")
|
||||
(puts "str")))
|
||||
((2) (puts "2"))
|
||||
(default (puts "more"))))
|
||||
1
example/fn-no-args.sex
Normal file
1
example/fn-no-args.sex
Normal file
@@ -0,0 +1 @@
|
||||
(pub fn void no-args-fn () ())
|
||||
@@ -1,8 +1,8 @@
|
||||
(include stdio.h)
|
||||
|
||||
(pub fn int main ((int argc) (char **argv))
|
||||
(puts "Hello from Sex!")
|
||||
(var (array char 512) name)
|
||||
(puts "Hello from Sex!")
|
||||
(puts "What is your name?")
|
||||
(scanf "%s" (cast char* &name))
|
||||
(printf "Hello, %s!\n" name)
|
||||
|
||||
25
example/polymorphism.sex
Normal file
25
example/polymorphism.sex
Normal file
@@ -0,0 +1,25 @@
|
||||
(include stdint.h)
|
||||
|
||||
(struct vec2
|
||||
((uint32_t x)
|
||||
(uint32_t y)))
|
||||
|
||||
(trait gui
|
||||
(fn void update ((float dt)))
|
||||
(fn void render ())
|
||||
(fn vec2 get-position ())
|
||||
(fn void add-child ((gui *w))))
|
||||
|
||||
(struct button
|
||||
((vector gui) children)
|
||||
((vec2 pos)))
|
||||
|
||||
(impl gui button
|
||||
(fn void update ((float dt))
|
||||
())
|
||||
(fn void render ()
|
||||
())
|
||||
(fn vec2 get-position ()
|
||||
(return self->pos))
|
||||
(fn void add-child ((gui *w))
|
||||
(push self->children w)))
|
||||
Reference in New Issue
Block a user