Free Pascal compiler internationalisation
description
Transcript of Free Pascal compiler internationalisation
![Page 1: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/1.jpg)
Free Pascal compiler internationalisation
Rimgaudas LauciusInstitute of Mathematics and Informatics,
Vilnius University
Lithuania
![Page 2: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/2.jpg)
Introduction
• Institute of Mathematics and Informatics, Informatics Methodology Department• Software localisation• Teaching of informatics and programming• E-learning and standards• Informatics terminology
• Vilnius University• Localisation course
![Page 3: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/3.jpg)
Localisation in Lithuania
• One of the four priorities emphasised in the strategic project for the development of the information society in Lithuania is:
“to uphold the inheritance of Lithuanian language and culture implementing the information technologies and telecommunications”
![Page 4: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/4.jpg)
Open Source in Lithuania
• Research which was carried out in 2004, “Open Source in Education” revealed that open source software integration into education has a large positive economical and also pedagogical effect
• Education requires high quality and fully localised software
• Open source software is more flexible in terms of localisation
![Page 5: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/5.jpg)
Free Pascal compiler
• Excellent, open source compiler• Works under all widely used operating
systems Windows, Linux and others• Widely used. Has been used in International,
Baltic and national Lithuanian Olympiads in informatics for a few years already
• Replacement for obsolete Turbo Pascal system in Lithuanian schools
![Page 6: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/6.jpg)
FPS
![Page 7: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/7.jpg)
Compilers’ internationalisation
• Internationalisation is part of the software development process, so the internationalisation of development tools is very important
• Most contemporary software development tools are not internationalised enough
• Though this research is done on Free Pascal compiler, most of represented issues are common to most of compilers
![Page 8: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/8.jpg)
Programming language standards
• Internationalisation relates with programming language standards
• Pascal programming language standards• Standards of other languages
![Page 9: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/9.jpg)
Examples of internationalised compilers
• There are not many of these examples• One of the most well known internationalised
programming system is LOGO• Vector Pascal
![Page 10: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/10.jpg)
Structure of Free Pascal
• Free Pascal is system made up of the compiler program itself and run-time library (RTL)
• Compiler and RTL interaction:
• Sometimes to change compiler one needs to change the RTL
![Page 11: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/11.jpg)
Support of multilingual source code
• This is the first stage of compiler internationalisation
• There are many scripts which require more than the 8-bit character set
![Page 12: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/12.jpg)
UTF-8 implementation
• Unicode ~ UTF-8• Some utilities used by compilers do not
support pure Unicode (Unicode chars may be treated as pairs of 8-bit chars; example U+0900 ~ 09 00, (tab and end of string))
• Allows step by step implementation of lexical extensions
![Page 13: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/13.jpg)
Lexical extensions
• Strings• Identifiers• Directives• Reserved words• Operators• Numbers
![Page 14: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/14.jpg)
Strings
• WideString implementation issues– Compatibility with other systems
– Ambiguity
– Conversions between Unicode and other character sets
![Page 15: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/15.jpg)
Ambiguity example
procedure go(const s: WideString); begin ... end;
procedure go(const s: String); begin ... end;
beginGo('Hi');
end.
Which overloaded procedures have to be called?
![Page 16: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/16.jpg)
Unicode support layer
• Unicode support layer wraps OS APIs’ in an OS independent way.
• Under Win9x implements Microsoft Layer for Unicode (MSLU)
![Page 17: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/17.jpg)
Identifiers
• Identifiers have to reflect clear meaning of object, be easy to comprehend and memorize. Best way to support these features is to allow use of identifiers written in vernacular language
• Unicode Standard Annex #31: Identifier and Pattern Syntax
![Page 18: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/18.jpg)
Directives
• Names• Parameters
– Logical (ON, OFF)
– Strings ({$warning Possible malfunctioning})
– File names ({$includepath ..\inc})
![Page 19: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/19.jpg)
Reserved words
• Unification myth– Compared 13 similar programming languages
(Algol, Pascal, Modula, Ada, C, Java,…)
– Only ~3% of reserved words are same
– 56% met only in particular language
• Possible unambiguous translation
![Page 20: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/20.jpg)
Example of localised reserved words
![Page 21: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/21.jpg)
Operators
• Unicode has all mathematical symbols needed to express mathematical operations
• Example:
![Page 22: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/22.jpg)
Numbers
• There are various scripts to express decimal numbers.
• Example:
![Page 23: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/23.jpg)
Decimal separator
• JAV, GB ‘.’• Most European countries ‘,’
• Localisation of delimiter may cause ambiguity.
Solution needs to extend syntax of numbers.
25,88 – real number
25, 88 – two numbers
![Page 24: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/24.jpg)
Punctuation
• Spaces: general U+0020, nonbreaking U+00A0, ideographic U+3000, etc
• Quotes: “English”, "Lithuanian“,
• Etc
![Page 25: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/25.jpg)
Bi-directional text
• Bi-directional text is an issue of text representation, not the compiler
![Page 26: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/26.jpg)
Unicode file names support
• Handling of files requires OS API, so it have to be done via RTL’s Unicode support layer
• Compilers have to use MSLU under Win9x
![Page 27: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/27.jpg)
Input/Output
• File input/output requires additional support for Unicode encoding
• Windows console does not support Unicode– It can be replaced but is it the best solution?
![Page 28: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/28.jpg)
Localisation framework
• Strings and other resources have to be externalised for easy localisation
• Localisation kits have to be prepared
![Page 29: Free Pascal compiler internationalisation](https://reader036.fdocuments.us/reader036/viewer/2022062304/568140a1550346895dac5888/html5/thumbnails/29.jpg)
• Questions?• Thank you
• Contact E-mail: