Concatenative topics
Concatenative meta
Other languages
Meta
Mogun is Factor-inspired and Factor-hosted language and is currently in early design stage. Its primary target is low-level speed-critical tasks, which you do not normally write on Factor itself (cell tags, GC, etc). Core of its design is programmer-friendly static typing with transparent and precise control over any compiler optimizations. Possibly, it's going to be LLVM-backended.
Only local stack shuffling primitive is ( .. ) syntax. It can rearrange and name any constant number of top stack elements. All other simple shufflers and combinators are normal words:
: drop ( >X ) ; : dup ( <X X ) ; : swap ( <Y X >Y ) ; : dip -- ( >X QUOT ) call X ; : keep -- ( X QUOT ) call X ; : 2drop drop drop ; : 2dip -- swap [ dip ] dip ; : bi -- [ keep ] dip call ; : bi* -- [ dip ] dip call ; : bi@ -- dup bi* ;
In combinators defititions you can see -- word, which do not appear in shufflers. This word is unusual for Factor and its function will be described later.
In Mogun any element on stack belongs to one of statically-distinguished class hierarhies. Inside each hierarhy classes can be statically or dynamically converted to each other. Classes can have additional slots with optimization-assisting values, avaliable at compile-time. Class from one hierarhy can simulate behaviour of other hierarhy, and can be used in its place.
CLASS: integer { min integer } { max integer } ;
CLASS: sgn ;
CLASS: positive < sgn ;
CLASS: zero < sgn ;
CLASS: negative < sgn ;
MIMIC: integer sgn
CLASS: fixed { bitcount integer } ;
CLASS: ufixed = fixed ;
CLASS: sfixed = fixed ;
MIMIC: ufixed integer
MIMIC: sfixed integerHere you can see three class hierarhies: integer, sgn and fixed. Class integer describes any integer value between min and max. Class sgn describes any number that can have sign. It can dynamically downcast to three subclasses: positive, zero and negative. MIMIC: integer sgn means that any integer value can be used everywhere, where sgn value or any its subclass is expected (obviously, because integers have sign). Class fixed describes bitfield of bitcount bits. Its value can be interpreted as unsigned or signed integer. Any ufixed and sfixed values can be converted to each other with static casting, and their usage in place of integer should generate different code.
This revision created on Thu, 4 Jun 2009 12:35:47 by Keyholder