Avail: زبان برنامه‌نویسی همه‌منظوره و اپن‌سورس

Avail: زبان برنامه‌نویسی همه‌منظوره و اپن‌سورس

Avail یک زبان برنامه‌نویسی اپن‌سورس، همه‌منظوره و اصطلاحاً مالتی‌پارادایم است که از یک ماشین‌ مجازی و همچنین لایبرری استاندارد نیز برخوردار است.

Avail در 28 آوریل 2014 در قالب یک زبان اپن‌سورس تحت لیسانس BSD منتشر شد. به عنوان سورس‌کد نوشته شده با این زبان داریم:

Module "Crimson Short One Choosable Path"
Versions
    "1.0.0 DEV 2014-04-28"
Uses
    "Avail",
    "Choosable Path"
Entries
    "Play Crimson Short One"
Body
 
Let the game context include
    boolean state
        "astronavigation exam requires revision" ✔ /
        "astronavigation exam does not require revision"
    whole number state
        "years served" (initially 15);
 
Let "Just Waking Up",
    "Studying is Hard",
    "Drive Room Maintenance",
    "Drive Room Diligence",
    and "Drive Room Disaster" be scenes;
 
Just Waking Up is described by
    "Yawwwn. You would've slept better if a certain gerbil-faced git hadn't
    kept you up all night with his uninspired guitar playing. Oh well. Time
    to face the day."
and has transitions
    to Studying is Hard
        described by
            "Your astronavigation exam is tomorrow. You really need to pass it
            so that you can become an officer and leave slob city behind.
            Better get cracking!"
    to Drive Room Maintenance
        described by
            "You should report for duty. You'd hate to get a reprimand!";
 
Studying is Hard
    is described by
        "You cover yourself with arcane mathematical formulae. Ha! You
        definitely won't write \"I am a fish\" on the test now!",
    upon entry does [Now astronavigation exam does not require revision;],
and has a transition
    to Drive Room Maintenance
        described by
            "Okay, guess it's time to report for duty.";
 
Drive Room Maintenance is described by
    "According to the duty roster, it's time to perform maintenance on the
    drive plate. Sounds like real work. Blech."
and has transitions
    to Drive Room Disaster
        described by
            "Poke around, but don't bother double checking the drive plate.
            Everything will be fine, and you have other things to do.",
    to Drive Room Diligence
        contingent on [astronavigation exam does not require revision]
        described by
        [
            time ::= years served + 5;
            "Better double check the drive plate. You'd hate for there to be
            some kind of freakish nuclear holocaust to interfere with
            acquiring your " ++ “time” ++ " years long service medal."
        ];
 
Drive Room Disaster is described by
    "You go about your day until you are suddenly transformed into a small pile
    of white dust by a nuclear explosion. \"Gazpacho soup…\"";
 
Drive Room Diligence is described by
    "It's a good thing that you checked the drive plate! It needed serious
    attention. Were it not for your diligence, there might have been a nuclear
    holocaust.\n\nCongratulations!";
 
Let Just Waking Up be the opening scene;
 
Verify story;
 
Method "Play Crimson Short One" is
[
    Play a game,
        creating a context with [a game context],
        interacting with standard console interface;
];

همان‌طور که ملاحظه می‌شود، سینتکس این زبان شباهت بسیاری به زبان انگلیسی دارد؛ لذا برای کدنویسی با زبان Avail آشنایی با زبان انگلیسی یک باید است.

از بهترین نوشته‌های کاربران سکان آکادمی در سکان پلاس


online-support-icon