Lichen

docs/wiki/Lichen

932:c07b0dd14f85
2021-06-28 Paul Boddie Moved integer instantiation support to library functions.
     1 = Lichen =     2      3 || [[/Downloads|Downloads]] || [[#Language|Language]] || [[#Toolchain|Toolchain]] || [[#Rationale|Rationale]] || [[#Documents|Documents]] ||     4      5 Lichen is both a Python-like [[/Design|language]] and a     6 [[/Toolchain|toolchain]] for that language.     7      8 Some objectives:     9     10  * Perform analysis on programs to better understand program structure and    11    behaviour    12  * Develop code generation capabilities    13  * Provide a platform for experimentation independent of existing Python    14    language and library implementations    15  * Provide independence from Python language evolution    16  * Learn things about writing compilers    17     18 Despite building on a long [[/History|history]] of experimentation, Lichen    19 still requires some [[/ToDo|work to be done]] for it to be more widely usable.    20     21 <<Anchor(Language)>>    22 == Language ==    23     24 The Lichen language [[/Design|foregoes]] various dynamic aspects of Python to    25 provide a foundation upon which more predictable programs can be built, while    26 preserving essential functionality to make the core of the language seem very    27 much "like Python" (thus yielding the name "Lichen"). The general syntax is    28 largely identical to Python, with only certain syntactic constructs being    29 deliberately unsupported, largely because the associated features are not    30 desired.    31     32 <<Anchor(Toolchain)>>    33 == Toolchain ==    34     35 The Lichen [[/Toolchain|toolchain]] employs existing tokeniser and parser    36 software to obtain an abstract syntax tree which is then inspected to provide    37 data to support deductions about the structure and nature of a given program.    38 With the information obtained from these processes, a program is then    39 constructed, consisting of a number of source files in the target compilation    40 language (which is currently the C programming language). This generated    41 program may be compiled and run, hopefully producing the results intended by    42 the source program's authors.    43     44 Lichen source files use the `.py` suffix since the language syntax is    45 superficially compatible with Python, allowing text editors to provide    46 highlighting and editing support for Lichen programs without the need to    47 reconfigure such tools. However, an alternative, recommended suffix is likely    48 to be introduced in future.    49     50 <<Anchor(Library)>>    51 == Library ==    52     53 Unlike other Python compilation efforts, Lichen programs employ a newly-written    54 library that is distinct from the CPython standard library distribution and    55 completely independent from the CPython extension and object libraries on which    56 Python programs being run with CPython must depend. Thus, there is no    57 dependency on any `libpython` for run-time functionality. Since the parts of    58 the Python standard library that are written in Python tend to be rather    59 variable in quality, there has been no real inclination to re-use modules from    60 that particular source, noting that they would need modifying to be compatible    61 with Lichen, anyway. However, rewriting such modules provides opportunities to    62 "do things right": with some functionality being over twenty years old and in    63 bad shape, this is arguably something that should have been done for Python,    64 anyway.    65     66 <<Anchor(Rationale)>>    67 == Rationale ==    68     69 Python has proven to be a readable, productive, comfortable-to-use and popular    70 programming language. However, as it has accumulated features, the precise    71 behaviour of programs making use of many of these features has become more    72 difficult to predict. Features added to provide even more convenience to the    73 programmer have often incurred run-time costs, introduced layers of    74 indirection, and have made programs even more inscrutable. Instead of    75 development tools reaching a point of being able to infer information about    76 programs, it has been suggested that programmers annotate their programs in    77 order to help tools understand those programs instead. Beyond superficial code    78 style analysis and providing tooltips in integrated development environments,    79 Python code analysis is often portrayed as a lost cause.    80     81 By employing a refined language [[/Design|design]], Lichen aims to let each    82 program define its [[/Structure|structure]] conveniently, be readily    83 [[/Inspection|inspected]], and thus support [[/Deduction|deductions]] about the    84 use of the program's objects by the code. The result should be more predictable    85 programs that can be [[/Translation|translated]] to other, more efficient,    86 [[/Representations|representations]]. The Lichen toolchain should be able to    87 tell the programmer useful things about their programs that it may also be able    88 to make use of itself. It not only aims to report information about programs    89 that might be of interest to the developer, but it seeks to produce    90 functioning, translated programs that can actually be run.    91     92 <<Anchor(Documents)>>    93 == Document Index ==    94     95 <<PageList>>