Backup: https://zhuanlan.zhihu.com/p/46030123
Code Address: Github:pyzh/gdpl-ex.poc-1
The original statement is: List1 is ' 12332234 '; note A is list1,b 2; Ask for the number of B in a
The whole process is this:
First the segmentation, and then judge the sentence attributes (this step is actually not strictly implemented in the code)
In the first sentence, because there is only one [for] the word, so you can think that the first sentence is an assignment statement;
And the second sentence has a [remember] the word, this in [Ld2] in the setting, is higher than [for] the priority, so the second sentence is actually [record + for] The definition of the statement;
The third sentence is the [seek] statement, which is calculated based on the previous article (assuming [ask: number] is a member of the standard library)
for [for] and [recorded] differences, in the setting, [for] can only specify a value, and [recorded as] can point to the value, also can point to the parameter (such as A→list1)
In the third sentence, [middle] determines the order of the levels A and B. about [the] word processing, the current LD2 has not been clear specification.
Origin: The count primitive in APL and ABC
Figure 2: Fluent Python python's direct ancestor/abc's count syntax
Reference:
- LD2/First draft: A DSL design approach based on Chinese-class SQL · Program-in-chinese/overview #89
- Commemoration of "APL" published 50
- ABC Quick reference:https://homepages.cwi.nl/~steven/abc/qr.html
Elixir East Travel: A simple Chinese sentence parsing