Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Alan `è` Bug
Room
There is a ball and a caffè here.
> ; ==============================================================================
> ; The 'è' Bug in Action
> ; ==============================================================================
> ; The parser seems unable to catch the 'è' (grave accent):
> cosa è ball
I don't know the word 'è'.
> cos'è ball
I don't know the word 'cos''.
> che cosa è ball
I don't know the word 'è'.
> che cos'è ball
I don't know the word 'cos''.
> ; ==============================================================================
> ; The 'é' Fallback
> ; ==============================================================================
> ; But using 'é' (acute accent) works alright:
> cosa é ball
You must discover yourself what the ball really is.
> cos'é ball
You must discover yourself what the ball really is.
> che cosa é ball
You must discover yourself what the ball really is.
> che cos'é ball
You must discover yourself what the ball really is.
> ; ==============================================================================
> ; 'è' in Instance Names
> ; ==============================================================================
> ; It looks like using an 'è' in instace names also creates problems:
> cosa é caffè
I don't know the word 'caff'.
> ; again, the 'è' is not being parsed!
> ; But using the instance's alternative name indicates that the instance is here:
> cosa é coffee
You must discover yourself what the caffè really is.
>
Do you want to UNDO, RESTART, RESTORE or QUIT ?
; ==============================================================================
; The 'è' Bug in Action
; ==============================================================================
; The parser seems unable to catch the 'è' (grave accent):
cosa è ball
cos'è ball
che cosa è ball
che cos'è ball
; ==============================================================================
; The 'é' Fallback
; ==============================================================================
; But using 'é' (acute accent) works alright:
cosa é ball
cos'é ball
che cosa é ball
che cos'é ball
; ==============================================================================
; 'è' in Instance Names
; ==============================================================================
; It looks like using an 'è' in instace names also creates problems:
cosa é caffè
; again, the 'è' is not being parsed!
; But using the instance's alternative name indicates that the instance is here:
cosa é coffee
--==============================================================================
-- "The 'è' Bug: Minimum Viable Test" by Tristano Ajmone
--==============================================================================
-- This file highlights a bug in Alan that prevents using the letter 'è' (E with
-- a grave accent) in a syntax definition.
-- It seems that using 'è' in anything that the player must type causes problems
-- in general, as the parser doesn't see this character.
-- I've tried using different code pages in CMD/batch settings, but to no avail:
-- Code Page 28591 = ISO 8859-1 Latin 1; Western European (ISO)
-- Code Page Windows 1252 = ANSI Latin 1; Western European (Windows)
-- The problem is also present when using the Gargoyle interpreter, so chances
-- are that it's an actual bug in the parser code.
-- Letter 'è' is character 00E8, which is supported by ISO/IEC 8859-1.
THE room IsA LOCATION
END THE room.
--==============================================================================
-- VERB "What is?"
--==============================================================================
-- In Italian "cosa è" means "what is". This verb works as a question regarding
-- instances in the game.
-- The "cosa è" question has also a shorthand spellings in Italian: "cos'è"; and
-- the forms "che cosa è" and "che cos'è" are common variations to the question.
SYNTAX cosa_è = cosa è (ogg)!
WHERE ogg IsA THING
ELSE "You can only use this verb to ask about things."
-- ---------------------------------------------
-- ALTERNATIVE SYNTAXES USING 'è' (grave accent)
-- ---------------------------------------------
-- None of these work, for the 'è' is not being parsed.
cosa_è = cosa é (ogg)!.
cosa_è = che cosa é (ogg)!.
cosa_è = 'cos''é' (ogg)!.
cosa_è = che 'cos''é' (ogg)!.
-- ------------------------------------------
-- FALLBACK SYNTAXES USING 'é' (acute accent)
-- ------------------------------------------
-- Using an 'é' instead of 'è' works (and other accented letters work too).
-- While the use of 'é' is incorrect in Italian, it was implemented just for the
-- sake of isolating the problem.
cosa_è = che cosa è (ogg)!.
cosa_è = 'cos''è' (ogg)!.
cosa_è = che 'cos''è' (ogg)!.
cosa_è = cosa sono (ogg)!.
cosa_è = che cosa sono (ogg)!.
ADD TO EVERY THING
VERB cosa_è
DOES "You must discover yourself what $+1 really is."
END VERB cosa_è.
END ADD TO.
--==============================================================================
-- Test Instances
--==============================================================================
THE ball IsA object AT room.
END THE.
--==============================================================================
-- 'è' in IDs/Names
--==============================================================================
-- The problem here is not creating an instance which has an 'è' in the ID,
-- rather the problem is the public name of the istance: names with 'è' will not
-- be parsable!
THE caffè IsA object AT room.
NAME caffè.
NAME coffee.
END THE.
Start at room.
CLS
@ECHO OFF
:: Code Page 28591 = ISO 8859-1 Latin 1; Western European (ISO)
rem CHCP 28591
:: Code Page Windows 1252 = ANSI Latin 1; Western European (Windows)
CHCP 1252
CALL alan egrav-bug.alan
CALL arun -r egrav-bug.a3c < egrav-bug.a3sol > egrav-bug.a3log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.