Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • DSA
  • Practice Problems
  • Python
  • C
  • C++
  • Java
  • Courses
  • Machine Learning
  • DevOps
  • Web Development
  • System Design
  • Aptitude
  • Projects
Open In App
Next Article:
10 Exciting Project Ideas Using Large Language Models (LLMs)
Next article icon

Creating WYSIWYG Document Editor | Natural Language Programming

Last Updated : 19 Sep, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

When my elder son and I finished writing our Plain English compiler, we decided to test its usefulness by adding a what-you-see-is-what-you-get document editor that we could then use to document our system. Two birds with one stone!

Document View

We call this facility the Writer. This is what our instruction manual looks like when you open it in the Writer:

We call this Document View: one line per page. Whole pages (and groups of pages, contiguous or not) can be selected, copied, cut, pasted, duplicated and printed in this view. They can also be saved in Adobe PDF format so folks without the Writer can read them.

Page View

When you open a page, you see that page exactly as it will appear when it is printed (or saved as a PDF page), albeit with sky-blue grid lines to aid in tasteful layout. This is how page 8 of our instruction manual appears on the screen:

In this view, whole pages can be enlarged, reduced, rotated, and spell-checked. And various text and graphic “shapes” can be added, deleted, moved, sized, colored, flipped, mirrored, rotated, copied, cut, pasted, duplicated, grouped, etc. The Home, End, Page Up, and Page Down keys can be used to conveniently flip through the pages, without returning to Document View.

Externalized Pages

Documents (and parts of documents) can be saved, as mentioned above, as PDFs. But the native format for permanent storage is much simpler, and is text only. Consider, for example, the document below, which has just one page with four shapes on it: a pink ellipse, a green triangle, a blue square, and a text box with “ABC” in it:

If you use our “Open as Text” command (or any other text editor) to open this document, this is what you’ll see:

ream cal-3024    page 15840 12240 1 1440      ellipse 0 0 0 0 1000 875 1440 1440 2880 2880      polygon 0 0 0 1500 1000 875 4 4320 1440 5760 2880 4320 2880 4320 1440      rectangle 0 0 0 2100 1000 875 7200 1440 8640 2880 0      text 0 0 0 -1 0 0 10080 1440 14400 2880 0 "title" "osmosian" 1440 "center" 0 0 0 yes         "ABC"      end    end  end

One entry for the whole document, one for each page, and one for each shape on the page. And not a single “<" in sight!

It would be too much to paste the 4,000 Plain English sentences that define the whole Writer here. They are included in the source code that comes with our system . For now, let’s settle for a sample routine:

To group any selected shapes on a page:  If the page is nil, exit.  Create a group shape.  Put "group" into the group shape's kind.  Put the page's scale into the group shape's scale.  Move the page's shapes to some original shapes.  Loop.  Put the original shapes' first into a shape.  If the shape is nil, break.  Remove the shape from the original shapes.  If the shape is not selected, append the shape to the page's shapes; repeat.  Deselect the shape.  Append the shape to the group shape's shapes.  Repeat.    Append the group shape to the page's shapes.  Select the group shape.  Adjust the group shape.  

Shapes on pages are drawn back-to-front, so the newly grouped shapes will appear on top of the other shapes on the page.

Not a Toy

Please keep in mind that this is facility is not a “toy.” We used it, as I mentioned above, to write the documentation for our system. And since then it’s been used to produce an 800-page illustrated “teach your kid to read” course . Not to mention several other books for children, numerous training manuals, and presentation materials of all kinds, large and small. This is one of my all-time favorite pages, developed by a grade school teacher in an attempt to settle an age-old question:

QED.



Next Article
10 Exciting Project Ideas Using Large Language Models (LLMs)

G

Gerry.Rzeppa
Improve
Article Tags :
  • Misc
  • Project
Practice Tags :
  • Misc

Similar Reads

  • Setting up Java Competitive Programming Environment
    An operating system is required to be installed on your system. here we will be discussing the setup in windows. However, you can choose any operating system. Install JDK (Java Development Kit) JDK, is a program that allows you to write Java code from the comfort of your desktop. It contains a varie
    5 min read
  • 10 Exciting Project Ideas Using Large Language Models (LLMs)
    Today the world is run by technology and the latest wizard of the tech world is the ChatGPT models and other LLMs(Large Language Models).  LLMs are very complexly designed AI models that process and generate large amounts of human data. They can mimic the activity of a professional human content exp
    12 min read
  • Creating Your Own Python IDE in Python
    In this article, we are able to embark on an adventure to create your personal Python Integrated Development Environment (IDE) the usage of Python itself, with the assistance of the PyQt library. What is Python IDE?Python IDEs provide a characteristic-rich environment for coding, debugging, and goin
    3 min read
  • Robotic Process Automation(RPA) - Notepad Automation using UIPath
    In this article, we are going to learn how we can automate the Notepad application using Uipath Studio. This project is a basic application of Robotic Process Automation (RPA). The user just needs to enter the content he/she wants to write in the notepad and name of the file to be saved in that's it
    4 min read
  • Wikipedia Summary Generator using Python Tkinter
    Prerequisite:  Tkinter Wikipedia Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. Python with Tkinter outputs the fastest and easiest way to create GUI applications. Wikipedia is a Python library tha
    2 min read
  • Simple Chatbot application using Python, GoogleAPIKey
    Google-GenerativeAI is Google AI Python SDK. It uses Gemini to build AI-powered features. In this article, we will see how to create a Simple Chatbot application using Python GoogleAPIKey. What is Google-GenerativeAI?Google-GenerativeAI is nothing but Google AI Python SDK. It enables to use of Gemin
    4 min read
  • Creating First Java Application in IntelliJ IDEA
    IntelliJ IDEA is a Java IDE that is one of the 3 biggest and most popular IDE’s in the world. It has two versions, namely the free open-source community edition and a paid Ultimate edition. Some features of IntelliJ IDEA are as follows: Both versions of IntelliJ IDEA support various programming lang
    4 min read
  • Online Code Compiler and Judging System | Source Code, UML diagrams, Project Report
    Online Code Compiler and Judging System is one of the most common software development projects today. In this article, we are going to develop the Online Code Compiler and Judging System software development project from scratch for final year students. We will be covering all the steps you need to
    15+ min read
  • 5 Reasons Why Python is Good for Beginners
    New beginnings are always exciting, be it starting college, joining a new sports team, selecting your first bike, or learning a new skill. But new beginnings can make us anxious, especially when these are related to our careers. Add to it the inexperience. A similar case can be made when someone dec
    6 min read
  • ML | Text Summarization of links based on user query
    Whenever a user searches for particular information on the internet, multiple results are returned which are explained in variety ways. It becomes difficult and time-consuming to understand information. Let's say for example when a user searches for “machine learning” on Google, number of results ar
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences