Skip to content

Instantly share code, notes, and snippets.

@tajmone
Created January 13, 2019 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tajmone/cd0d30face8f57025497458ed02a8269 to your computer and use it in GitHub Desktop.
Save tajmone/cd0d30face8f57025497458ed02a8269 to your computer and use it in GitHub Desktop.
Alan 3.0beta6 build 1852 -- Test Apostrophes Elisions
Garden
There is a albero here.
> ; "climb on the tree" (bad Italian):
> arrampicati su albero
You climb the albero!
> ; "climb on the tree" (correct Italian):
> arrampicati sull'albero
You climb the albero!
> ; "hide in the tree" (bad Italian):
> nasconditi in albero
You hide in the albero!
> ; "hide in the tree" (correct Italian):
> nasconditi nell'albero
You hide in the albero!
> ; "go to the tree" (bad Italian):
> vai a albero
You got to the albero!
> ; "go to the tree" (correct Italian):
> vai all'albero
You got to the albero!
> ; "examine top of the tree" (bad Italian):
> esamina cima di albero
You examine the top of the albero!
> ; "examine top of the tree" (correct Italian):
> esamina cima dell'albero
You examine the top of the albero!
>
Do you want to UNDO, RESTART, RESTORE or QUIT ?
-- Alan 3.0beta6 build 1852
--==============================================================================
--------------------------------------------------------------------------------
-- Testing Apostrophe Elision in Aritcles as Noise Words
--------------------------------------------------------------------------------
--==============================================================================
-- This adventura tests the new "Handle elisions (contractions) with apostrophes"
-- introduced in commit 1bfc8f7 to support languages like Italian and French:
-- https://bitbucket.org/alanif/alan/commits/1bfc8f7
--------------------------------------------------------------------------------
THE garden IsA location.
-- Trees grow in gardens, right?
END THE garden.
SYNTAX climb = arrampicati su (obj). --> "climb on (obj)"
SYNTAX hide_in = nasconditi 'in' (obj). --> "hide in (obj)"
SYNTAX goto = vai a (obj). --> "go to (obj)"
SYNTAX examine_top = esamina cima di (obj). --> "examine top of (obj)"
ADD TO EVERY object
VERB climb
DOES
"You climb the $1!"
END VERB.
VERB hide_in
DOES
"You hide in the $1!"
END VERB.
VERB goto
DOES
"You got to the $1!"
END VERB.
VERB examine_top
DOES
"You examine the top of the $1!"
END VERB.
END ADD TO object.
THE albero IsA object AT garden.
-- "albero" is "tree" in Italian:
-- * "un albero" -> "a tree"
-- * "l'albero" -> "the tree"
END THE albero.
--------------------------------------------------------------------------------
-- NOISE WORDS
--------------------------------------------------------------------------------
-- Let's define articles as noise.
-- When the new elision feature splits a word with apostrophe in two, the "l''"
-- will be treated as noise on reparsing.
SYNONYMS
-- Determinate Articles:
'l''', il, lo, la, i, gli, le = 'the'.
-- eg "esamina l'albero" -> "examine the tree"
--------------------------------------------------------------------------------
-- "PREPOSITIONS + DEFINITE ARTICLE" SYNONYMS
--------------------------------------------------------------------------------
-- Prepositions with apostrophes will be handled by the new feature which splits
-- words with apostrophe into two words, and when it reparses them they must
-- be treated as their simple-preposition counterparts (without article).
SYNONYMS
'all''', al, allo, alla, ai, agli, alle = a. --> "TO"
-- eg "vai all'albero" -> "go to the tree"
'dell''', del, dello, della, dei, degli, delle = di. --> "OF"
-- eg "cima dell'albero" -> "top of the tree"
'nell''', nel, nello, nella, nei, negli, nelle = 'in'. --> "IN"
-- eg "nasconditi nell'albero" -> "hide in the tree"
'sull''', sul, sullo, sulla, sui, sugli, sulle = su. --> "ON"
-- eg "sali sull'albero" -> "climb on the tree"
START AT garden.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment