词条 | PCASTL |
释义 |
| designer = Philippe Choquette | developer = Philippe Choquette | influenced_by = C, R | latest_release_version = 3.5 | latest_release_date = {{Start date and age|2018|03|31}} | license = GNU Lesser General Public License | operating_system = Cross-platform | paradigm = imperative, reflective | year = {{Start date and age|2008}} | website = {{URL|www.pcosmos.ca/pcastl/}} }} The PCASTL (an acronym for by Parent and Childset Accessible Syntax Tree Language) is an interpreted high-level programming language. It was created in 2008 by Philippe Choquette.[1] The PCASTL is designed to ease the writing of self-modifying code. The language has reserved words parent and childset to access the nodes of the syntax tree of the currently written code.[2] Hello worldThe "Hello world program" is quite simple: "Hello, world!" or print("Hello, world!") will do the same. SyntaxThe syntax of PCASTL is derived from programming languages C and R. The source of R version 2.5.1 has been studied to write the grammar and the lexer used in the PCASTL interpreter. InfluencesLike in R, statements can, but do not have to, be separated by semicolons.[3] Like in R, a variable can change type in a session. Like in C and R, PCASTL uses balanced brackets ({ and }) to make blocks. Operators found in PCASTL have the same precedence and associativity as their counterparts in C.[2][4] for loops are defined like in C. An example of PCASTL using the for reserved word and the Functions and comments in PCASTL are defined like in R: parent and childset reserved wordsThose reserved words can only be written lowercase and will not be recognized otherwise. The parent reserved word gives a reference to the parent node in the syntax tree of the code where the word is placed. In the following code, the parent node is the operator a = parent The variable "a" will hold a reference to the a.childset[0]a.childset[1] To display the value of "a", some ways are given in this example: aa.childset[0].parenta.childset[1].parenta.childset[0].parent.childset[0].parent # and so on... In the following code: we assign a code segment to the right child of the a.childset[1] = `function() print("hello")'execute(a)a() See also{{Portal|Free and open-source software}}
References1. ^{{cite web|accessdate=2008-06-14|url=http://www.pcosmos.ca/|title=pcosmos.ca |publisher=Philippe Choquette }} 2. ^1 {{cite web|accessdate=2008-06-14 | url=http://www.pcosmos.ca/pcastl/|title=PCASTL: by Parent and Childset Accessible Syntax Tree Language |publisher=Philippe Choquette }} 3. ^{{cite web|accessdate=2008-06-14|url=https://cran.r-project.org/doc/manuals/R-intro.html|title=An Introduction to R |publisher=R Development Core Team }} 4. ^{{cite book | last=Hanly | first=Jeri R. |author2=Elliot B. Koffman | title=Problem Solving & Program Design in C, Third Edition | publisher = Addison-Wesley | year=1999 | isbn=0-201-35748-8 }} External links
4 : Free compilers and interpreters|Procedural programming languages|Articles with example code|Programming languages created in 2008 |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。