A Model for Naturalistic Programming with Implementation
Abstract
:Featured Application
Abstract
1. Introduction
2. Background
Related Work
3. Conceptual Model
- A noun as a base abstraction that is either singular or plural.
- An adjective as a complement to the noun.
- A verb as an action undertaken by a noun.
- A circumstance as a determinant that responds to events.
- A phrase used to define instructions with a complexity beyond that of the subject and the predicate.
- The element must enable the definition of instructions in terms of those elements previously described (anaphoras).
- As types are defined explicitly and statically, they are used in the construction of instructions comprising phrases.
- The conceptual model is implemented via a textual language that offers a level of expressiveness similar to a natural language, but which is formalized in order to avoid ambiguity.
- Complete support for the deixis, which implies that the instructions are defined according to the elements that are described not only before but also after the same text.
- Support for identifiers that enable work with the abstractions by means of direct references.
- Property-based typing, which requires the classification of a noun based on its properties, and, therefore, has the capacity to add new properties to an abstraction when it is created.
3.1. Circumstance
3.2. Sentence
3.3. Indirect Reference
3.4. Explicit Typing
4. Language
- 1 main Example:
- 2 System prints “Hello World”.
- 1 class Example {
- 2 public static void main(String...arg) {
- 3 System.out.print(“Hello World”);}}
4.1. Abstractions
4.1.1. Noun
- noun House.
- noun Building.
- noun House is a Building.
- noun House is a Building with plural as Houses.
4.1.2. Adjective
- adjective Luxurious.
- adjective Big.
- adjective Luxurious is Big.
- adjective Costly.
- adjective Luxurious is Big and Costly.
- noun Mansion is a Luxurious House.
4.2. Instance Creation
- a House.
- some Houses.
- a House with 5000.0 as price.
- noun House:
- attribute price as a Real Number.
- a Luxurious House.
4.3. Noun Phrases in Sentences
- the first House
- the last Building
- the second House
- a House with 20,000.00 as price.
- a House with 60,000.00 as price.
- a House with 40,000.00 as price.
- the first House where price is equal to 40,000.00
- the last House where price is lesser than 60,000.00
- noun Building with plural as Buildings:
- attribute price as Real Number.
- adjective Costly.
- adjective Big.
- noun House is a Building with plural as Houses.
- noun Mansion is a Big and Costly House.
- 1 a House with 20,000.00 as price.
- 2 a Costly House with 60,000.00 as price.
- 3 a Mansion with 80,000.00 as price.
- 4 a Building with 10,000.00 as price.
- 1 System prints the first Building.
- 2 System prints the first Building where price is equal to 60,000.00.
- 3 System prints the second Building.
- 4 System prints the last House.
- 5 System prints the Big House.
- 6 System prints the House where price is equal to 30,000.00.
- all Houses
- the last 3 Houses
- all Houses where price is greater than 25,000
- the last 3 Houses where price is equal to 500,000
- 1 System prints all Buildings.
- 2 System prints the first 3 Buildings.
- 3 System prints the last 2 Buildings.
- 4 System prints the first 2 Costly House.
4.4. Local Identifiers
- house is a Luxurious House.
- h is house.
- num is 5.
- str is “A string”.
4.5. Circumstance
4.5.1. Circumstances Applied to Instances
- 1 noun Building:
- 2 circumstance: this cannot be Integer or Real.
- 3 circumstance: Office and Habitable are mutually excluded.
- 4 circumstance: this requires Habitable or Office.
- 1 adjective Office:
- 2 circumstance: this cannot be Habitable.
- 3 adjective Habitable:
- 4 circumstance: this cannot be Office.
- 1 a Building.
- 2 an Office Building.
- 3 an Integer Building.
- 4 a Habitable Building.
- 5 an Office and Habitable Building.
- 1 adjective Printable:
- 2 verb print itself:
- 3 System prints “A new house was created”.
- 4 circumstance: print this after this is created.
- a Printable House.
- A new house was created
4.5.2. Circumstances Applied to Attributes
- 1 noun House:
- 2 attribute description as String.
- 3 verb itself prints desc as String:
- 4 System prints desc.
- 5 circumstance: it prints description
- when the description is assigned.
- a House with “A beautiful house” as description.
- the description of the House is “Another description”.
- System prints the description of the House.
- A beautiful house
- Another description
- 1 noun House:
- 2 attribute description is “”.
- 3 verb itself prints desc as String:
- 4 System prints desc.
- 5 circumstance: it prints description
- when the length of description is 0.
- a House with “A beautiful house” as description.
- the description of the House is “Another description”.
- System prints the description of the House.
- Another description
- a House.
- the description of the House is “Another description”.
- System prints the description of the House.
- Another description
- Another description
4.5.3. Circumstances Applied to Verbs
- 1 noun Mansion:
- 2 attribute price as an Integer Number.
- 3 verb assign p as Integer Number to itself:
- 4 the price of this is p.
- 5 derived attribute string as a String:
- 6 a String with “Mansion valued as ”.
- 7 add price to the String.
- 8 return it.
- 1 adjective Validated:
- 2 verb itself validates val as Integer Number:
- 3 execute the next instruction when val is null.
- 4 the price of this is 0.
- 5 execute the next instruction when val is not null.
- 6 the price of this is val.
- 7 circumstance: this validates val instead assign val to something.
- a Mansion.
- a Validated Mansion.
- the price of it is null.
- System prints the first Mansion and newline.
- System prints the last Mansion and newline.
- Mansion valued as null
- Mansion valued as 0
4.6. Naturalistic Control Structures
4.6.1. Naturalistic Iterator
4.6.2. Naturalistic Conditional
- flag is false.
- execute the next 3 instructions when flag is equal to false.
- System prints “Optional output”.
- System prints “Another output”.
- flag is true.
- System prints “From the outside”.
5. Compiler
5.1. Scala Generation
- noun House.
- adjective Big.
- adjective Costly.
- class House
- trait Big
- trait Costly
- main Example:
- h1 is a Big House.
- h2 is a Costly House.
- h3 is a Big and Costly House.
- h4 is a Costly and Big House.
- object Example extends scala.App {
- var h1 = new House with Big
- var h2 = new House with Costly
- var h3 = new House with Big with Costly
- var h4 = new House with Costly with Big}
- Big.class
- Costly.class
- House.class
- Example.class
- Example$.class
- Example$$anon$delayedInit$body.class
- Example$$anon$1.class
- Example$$anon$2.class
- Example$$anon$3.class
- Example$$anon$4.class
- noun Number:
- verb itself plus arg as Number.
- class Number
- public Number plus(arg : Number)
5.2. AspectJ Generation
- noun House:
- circumstance: Big and Costly are mutually excluded.
- House_ValidatorAspect.class
6. Test Scenarios
6.1. Case 1: Operations with Numbers
- 1 abstract noun Number is a Thing with plural as Numbers:
- 2 verb add number as Number to itself.
- 3 verb itself plus number as Number.
- 4 verb subtract number as Number from itself.
- 5 verb itself minus number as Number.
- 6 verb multiply number as Number by itself.
- 7 verb itself times number as Number.
- 8 verb divide number as Number by itself.
- 9 verb itself by number as Number.
- 10 verb leftover number as Number by itself.
- 11 verb itself mod number as Number.
- 12 adjective Integer.
6.2. Case 2: Database Connection
6.3. Case 3: Encoding Process
7. SN Evaluation
7.1. Programming Example
7.2. Questionnaire
8. Conclusions and Future Work
Author Contributions
Funding
Acknowledgments
Conflicts of Interest
Abbreviations
ACE | Attempto Controlled English |
AOP | Aspect-Oriented Programming |
API | Application Programming Interface |
CPL | Computer-Processable Language |
JVM | Java Virtual Machine |
LTW | Load-Time Weaving |
NLC | Natural Language Computer |
NLCI | Natural Language Command Interpreter |
OOP | Object-Oriented Programming |
SBT | Simple Build Tool |
CONACyT | Consejo Nacional de Ciencia y Tecnología |
Appendix A. Conceptual Model Description
Appendix A.1. Noun
Appendix A.2. Adjective
Appendix A.3. Verb
Appendix A.4. Property-Based Typing
Appendix B. SN Grammar
Appendix B.1. Program Structure
Appendix B.2. Main
Appendix B.3. Noun
Appendix B.4. Adjective
Appendix B.5. Attribute
Appendix B.6. Verb
- a House.
- sell the House.
- a House.
- a Client.
- add the Client to the House.
- a House.
- the House sold.
Appendix B.7. Circumstance
Appendix B.7.1. Instance Circumstance
Appendix B.7.2. Attribute Circumstance
Appendix B.7.3. Verb Circumstance
Appendix B.8. Derived Attribute
Appendix B.9. Plurals
Appendix B.10. Noun Phrase
Appendix B.11. Sentence
Appendix B.12. Access to Attributes
Appendix B.13. Naturalistic Iterator
Appendix B.14. Naturalistic Conditional
Appendix B.15. Composite Sentence
Appendix B.16. Composite Iterator and Composite Decision
Appendix B.17. Local Identifiers
Appendix B.18. Complementary rules
Appendix C. Database Access with PostgreSQL
Appendix C.1. Storable (Adjective)
Appendix C.2. Person (Noun)
Appendix C.3. Insert
Appendix C.4. Delete
Appendix C.5. Update
Appendix D. Questionnaire
Appendix D.1. Question 1
Appendix D.2. Question 2
Appendix D.3. Question 3
Appendix D.4. Question 4
Appendix D.5. Question 5
Appendix D.6. Question 6
Appendix D.7. Question 7
Appendix D.8. Question 8
Appendix D.9. Question 9
Appendix D.10. Question 10
Appendix D.11. Question 11
Appendix D.12. Question 12
Appendix D.13. Question 13
Appendix D.14. Question 14
Appendix D.15. Question 15
Appendix D.16. Question 16
Appendix D.17. Question 17
Appendix D.18. Question 18
Appendix D.19. Question 19
Appendix D.20. Question 20
Appendix D.21. Question 21
Appendix D.22. Question 22
References
- Sammet, J.E. The Use of English As a Programming Language. Commun. ACM 1966, 9, 228–230. [Google Scholar] [CrossRef]
- Kiczales, G.; Lamping, J.; Mendhekar, A.; Maeda, C.; Lopes, C.; Loingtier, J.M.; Irwin, J. Aspect-oriented programming. In ECOOP’97—Object-Oriented Programming; Akşit, M., Matsuoka, S., Eds.; Springer: Berlin/Heidelberg, Germany, 1997; pp. 220–242. [Google Scholar]
- Laddad, R. AspectJ in Action: Practical Aspect-Oriented Programming; Manning Publications Co.: Greenwich, CT, USA, 2003. [Google Scholar]
- Biermann, A.W.; Ballard, B.W. Toward Natural Language Computation. Comput. Linguist. 1980, 6, 71–86. [Google Scholar]
- Lopes, C.V.; Dourish, P.; Lorenz, D.H.; Lieberherr, K. Beyond AOP: Toward Naturalistic Programming. SIGPLAN Not. 2003, 38, 34–43. [Google Scholar] [CrossRef]
- Knöll, R.; Gasiunas, V.; Mezini, M. Naturalistic Types. In Proceedings of the 10th SIGPLAN Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (Onward! 2011), Ortland, OR, USA, 22–27 October 2011; ACM: New York, NY, USA, 2011; pp. 33–48. [Google Scholar] [CrossRef]
- Van Roy, P.; Haridi, S. Concepts, Techniques, and Models of Computer Programming, 1st ed.; MIT Press: Cambridge, MA, USA, 2004. [Google Scholar]
- Booch, G.; Maksimchuk, R.A.; Engle, M.W.; J. Young, B.; Conallen, J.; Kelli, A.H. Object-Oriented Analysis and Design with Applications, 3rd ed.; Addison Wesley Longman: Boston, MA, USA, 2007. [Google Scholar]
- Lyons, J. Deixis, space and time. Semantics 1977, 2, 636–724. [Google Scholar]
- Ogden, C.K.; Richards, I.A.; Ranulf, S.; Cassirer, E. The Meaning of Meaning. A Study of the Influence of Language upon Thought and of the Science of Symbolism; Harcourt, Brace & World, Inc.: New York, NY, USA, 1923. [Google Scholar]
- de Saussure, F.; Baskin, W.; Meisel, P.; Saussy, H. Course in General Linguistics; Columbia University Press: New York, NY, USA, 2011; pp. 65–70. [Google Scholar]
- Knöll, R.; Mezini, M. Pegasus: First Steps Toward a Naturalistic Programming Language. In Companion to the 21st ACM SIGPLAN Symposium on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA ’06), Portland, OR, USA, 22–26 October 2006; ACM: New York, NY, USA, 2006; pp. 542–559. [Google Scholar] [CrossRef]
- Chomsky, N. Three models for the description of language. IRE Trans. Inf. Theory 1956, 2, 113–124. [Google Scholar] [CrossRef] [Green Version]
- Clark, P.; Murray, W.R.; Harrison, P.; Thompson, J. Controlled Natural Language: Workshop on Controlled Natural Language, CNL 2009, Marettimo Island, Italy, June 8-10, 2009. Revised Papers. In Controlled Natural Language: Workshop on Controlled Natural Language, CNL 2009, Marettimo Island, Italy, June 8–10, 2009. Revised Papers; Chapter Naturalness vs. Predictability: A Key Debate in Controlled Languages; Springer: Berlin/Heidelberg, Germany, 2010; pp. 65–81. [Google Scholar] [CrossRef]
- École Polytechnique Fédérale Lausanne (EPFL). Scala Online Resources. 2019. Available online: https://docs.scala-lang.org/learn.html (accessed on 20 July 2019).
- Liu, H.; Lieberman, H. Programmatic Semantics for Natural Language Interfaces. In Proceedings of the CHI ’05 Extended Abstracts on Human Factors in Computing Systems (CHI EA ’05), Portland, OR, USA, 2–7 April 2005; ACM: New York, NY, USA, 2005; pp. 1597–1600. [Google Scholar] [CrossRef]
- Mihalcea, R.; Liu, H.; Lieberman, H. NLP (Natural Language Processing) for NLP (Natural Language Programming). In Proceedings of the 7th International Conference on Computational Linguistics and Intelligent Text Processing (CICLing’06), Mexico City, Mexico, 19–25 February 2006; Springer: Berlin/Heidelberg, Germany, 2006; pp. 319–330. [Google Scholar] [CrossRef] [Green Version]
- Cann, R. Formal Semantics: An Introduction; Cambridge University Press: New York, NY, USA, 1993. [Google Scholar]
- Cremet, V. Foundations for Scala: Semantics and Proof of Virtual Types; Technical Report; École Polytechnique Fédérale de Lausanne: Lausanne, Switzerland, 2006. [Google Scholar]
- Belblidia, N.; Debbabi, M. Towards a Formal Semantics for Aspectj Weaving. In Proceedings of the 7th Joint Conference on Modular Programming Languages (JMLC’06), Oxford, UK, 13–15 September 2006; Springer: Berlin/Heidelberg, Germany, 2006; pp. 155–171. [Google Scholar] [CrossRef]
- Pulido-Prieto, O.; Juárez-Martínez, U. A Survey of Naturalistic Programming Technologies. ACM Comput. Surv. 2017, 17:1–17:39. [Google Scholar] [CrossRef]
- Fuchs, N.E.; Schwitter, R. Attempto Controlled English (ACE). arXiv 1996, arXiv:cmp-lg/9603003. [Google Scholar]
- Fuchs, N.; Schwertel, U.; Schwitter, R. Attempto Controlled English Language Manual Version 3.0; Institut für Informatik der Universität Zürich: Geneva, Switzerland, 1999. [Google Scholar]
- Fuchs, N.E.; Kaljurand, K.; Kuhn, T. Reasoning Web. In Reasoning Web; Chapter Attempto Controlled English for Knowledge Representation; Baroglio, C., Bonatti, P.A., Maluszyński, J., Marchiori, M., Polleres, A., Schaffert, S., Eds.; Springer: Berlin/Heidelberg, Germany, 2008; pp. 104–124. [Google Scholar] [CrossRef]
- Kuhn, T.; Bergel, A. Verifiable Source Code Documentation in Controlled Natural Language. Sci. Comput. Program. 2014, 96, 121–140. [Google Scholar] [CrossRef]
- Clark, P.; Harrison, P.; Jenkins, T.; Thompson, J.; Wojcik, R. Acquiring and using world knowledge using a restricted subset of English. In Proceedings of the Eighteenth International Florida Artificial Intelligence Research Society Conference (FLAIRS 2005), Clearwater Beach, FL, USA, 15–17 May 2005; AAAI Press: Menlo Park, CA, USA, 2005; pp. 506–511. [Google Scholar]
- Liu, H.; Lieberman, H. Metafor: Visualizing Stories As Code. In Proceedings of the 10th International Conference on Intelligent User Interfaces (IUI ’05), San Diego, CA, USA, 9–12 January 2005; ACM: New York, NY, USA, 2005; pp. 305–307. [Google Scholar] [CrossRef]
- Cozzie, A.; Finnicum, M.; King, S.T. Macho: Programming with Man Pages. In Proceedings of the 13th USENIX Conference on Hot Topics in Operating Systems (HotOS’13), Napa, CA, USA, 9–11 May 2011; USENIX Association: Berkeley, CA, USA, 2011; p. 7. [Google Scholar]
- Cozzie, A.; King, S.T. Macho: Writing Programs with Natural Language and Examples; Technical Report; University of Illinois at Urbana-Champaign: Champaign County, IL, USA, 2012. [Google Scholar]
- Landhäußer, M.; Hug, R. Text Understanding for Programming in Natural Language: Control Structures. In Proceedings of the Fourth International Workshop on Realizing Artificial Intelligence Synergies in Software Engineering (RAISE ’15), Florence/Firenze, Italy, 16–24 May 2015; IEEE Press: Piscataway, NJ, USA, 2015; pp. 7–12. [Google Scholar]
- Landhäußer, M.; Weigelt, S.; Tichy, W.F. NLCI: A natural language command interpreter. Autom. Softw. Eng. 2016, 27, 839–861. [Google Scholar] [CrossRef]
- Bracha, G.; Cook, W. Mixin-based Inheritance. In Proceedings of the European Conference on Object-oriented Programming on Object-oriented Programming Systems, Languages, and Applications (OOPSLA/ECOOP ’90), Ottawa, ON, Canada, 21–25 October 1990; ACM: New York, NY, USA, 1990; pp. 303–311. [Google Scholar] [CrossRef]
- Parr, T. The Definitive ANTLR 4 Reference, 2nd ed.; Pragmatic Bookshelf: Raleigh, NC, USA, 2013. [Google Scholar]
- Odersky, M.; Spoon, L.; Venners, B. Programming in Scala: A Comprehensive Step-by-Step Guide, 1st ed.; Artima Incorporation: Walnut Creek, CA, USA, 2008. [Google Scholar]
- Inc., L. SBT Reference Manual. 2019. Available online: https://www.scala-sbt.org/1.x/docs/Faq.html (accessed on 20 July 2019).
- Eckel, B. Thinking in Java, 3rd ed.; Prentice Hall: Upper Saddle River, NJ, USA, 2002. [Google Scholar]
- Bruckman, A.S. Moose Crossing: Construction, Community, and Learning in a Networked Virtual World for Kids. Ph.D. Thesis, Massachusetts Institute of Technology, Cambridge, MA, USA, 1997. [Google Scholar]
- Landhäußer, M.; Hey, T.; Tichy, W.F. Deriving Time Lines from Texts. In Proceedings of the 3rd International Workshop on Realizing Artificial Intelligence Synergies in Software Engineering (RAISE 2014), Hyderabad, India, 31 May–7 June 2014; ACM: New York, NY, USA, 2014; pp. 45–51. [Google Scholar] [CrossRef]
- Likert, R. A Technique for the Measurement of Attitudes. Ph.D. Thesis, New York University, New York, NY, USA, 1932. [Google Scholar]
Question | Inexpressive/ Not Useful | Little Expressive Little Useful | Moderately Expressive Moderately Useful | Highly Expressive Very Useful |
---|---|---|---|---|
1 | 10.2% | 36.7% | 40.8% | 12.2% |
2 | 2% | 38.8% | 51% | 8.2% |
3 | 8.2% | 34.7% | 36.7% | 20.4% |
6 | 10.2% | 34.7% | 49% | 6.1% |
7 | 2% | 38.8% | 46.9% | 12.2% |
8 | 4.1% | 34.7% | 38.8% | 22.4% |
9 | 2% | 26.5% | 57.1% | 14.3% |
10 | 4.1% | 36.7% | 46.9% | 12.2% |
11 | 4.1% | 32.7% | 51% | 12.2% |
12 | 10.2% | 28.6% | 49% | 12.2% |
13 | 6.1% | 32.7% | 38.8% | 22.4% |
14 | 14.3% | 32.7% | 40.8% | 12.2% |
15 | 14.3% | 20.4% | 57.1% | 8.2% |
16 | 6.1% | 30.6% | 40.8% | 22.4% |
17 | 8.2% | 28.6% | 53.1% | 10.2% |
18 | 0 | 8.2% | 59.2% | 32.7% |
19 | 4.1% | 42.9% | 40.8% | 12.2% |
20 | 10.2% | 22.4% | 59.2% | 8.2% |
21 | 6.1% | 22.4% | 55.1% | 16.3% |
22 | 0 | 20.4% | 59.2% | 20.4% |
Question | Yes | No |
---|---|---|
4 | 55.1% | 44.9 |
5 | 51% | 49 |
© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
Share and Cite
Pulido-Prieto, O.; Juárez-Martínez, U. A Model for Naturalistic Programming with Implementation. Appl. Sci. 2019, 9, 3936. https://doi.org/10.3390/app9183936
Pulido-Prieto O, Juárez-Martínez U. A Model for Naturalistic Programming with Implementation. Applied Sciences. 2019; 9(18):3936. https://doi.org/10.3390/app9183936
Chicago/Turabian StylePulido-Prieto, Oscar, and Ulises Juárez-Martínez. 2019. "A Model for Naturalistic Programming with Implementation" Applied Sciences 9, no. 18: 3936. https://doi.org/10.3390/app9183936
APA StylePulido-Prieto, O., & Juárez-Martínez, U. (2019). A Model for Naturalistic Programming with Implementation. Applied Sciences, 9(18), 3936. https://doi.org/10.3390/app9183936