mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2026-01-05 22:38:16 +00:00
changes for new grammar, fixes
This commit is contained in:
parent
91f9affadc
commit
3106a64949
35 changed files with 605 additions and 550 deletions
|
|
@ -1,59 +1,59 @@
|
|||
struct Fruit =
|
||||
| Apple
|
||||
| Orange
|
||||
| Banana
|
||||
struct \fruit =
|
||||
| $apple
|
||||
| $orange
|
||||
| $banana
|
||||
|
||||
struct Optional 'A =
|
||||
| Some & 'A
|
||||
| None
|
||||
struct \optional 'a =
|
||||
| $some & 'a
|
||||
| $none
|
||||
|
||||
struct (Result : #Move) 'A 'B =
|
||||
| & 'A
|
||||
| Error & 'B
|
||||
struct \result[#move] 'a 'b =
|
||||
| & 'a
|
||||
| $error & 'b
|
||||
|
||||
struct (Complex : #Value) =
|
||||
& Float
|
||||
& Float
|
||||
struct \complex[#value] =
|
||||
& \float
|
||||
& \float
|
||||
|
||||
struct Task =
|
||||
& name : String
|
||||
& duration : Float!
|
||||
struct \task =
|
||||
& name : \string
|
||||
& duration : \float?
|
||||
|
||||
class Employee =
|
||||
& name : String
|
||||
class \employee =
|
||||
& name : \string
|
||||
& role :
|
||||
( | Director
|
||||
& importance : Float
|
||||
& share : Float
|
||||
| Manager
|
||||
( | $director
|
||||
& importance : \float
|
||||
& share : \float
|
||||
| $manager
|
||||
& productivity :
|
||||
( Productivity
|
||||
| .Low
|
||||
| .Average
|
||||
| .High
|
||||
& duration : Float
|
||||
& sleep_on_work :
|
||||
(SleepOnWork
|
||||
| ..Yes
|
||||
| ..No
|
||||
( \productivity
|
||||
| $.low
|
||||
| $.average
|
||||
| $.high
|
||||
& duration : \float
|
||||
& sleep-on-work :
|
||||
( \sleep-on-work
|
||||
| $..yes
|
||||
| $..no
|
||||
))
|
||||
& salary : Int
|
||||
| Programmer
|
||||
& skills : Float
|
||||
& current_task : (Optional Task)
|
||||
& salary : Int)
|
||||
& salary : \int
|
||||
| $programmer
|
||||
& skills : \float
|
||||
& current-task : \optional[task]
|
||||
& salary : \int)
|
||||
|
||||
|
||||
class Bag =
|
||||
class \bag =
|
||||
&
|
||||
( | Apple
|
||||
| Orange
|
||||
| Banana)
|
||||
& bag_type :
|
||||
( | Small
|
||||
| Medium
|
||||
& weight_kg : Int
|
||||
& weight_g : Int
|
||||
& weight_g : Int
|
||||
| Big)
|
||||
& other_things : (Array Something)
|
||||
( | $apple
|
||||
| $orange
|
||||
| $banana)
|
||||
& bag-type :
|
||||
( | $small
|
||||
| $medium
|
||||
& weight-kg : \int
|
||||
& weight-g : \int
|
||||
& weight-mg : \int
|
||||
| $big)
|
||||
& other-things : \array[something]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue