The Text Editor sam
给sam介绍北京英语作文

给sam介绍北京英语作文Here is an English essay on the topic of introducing Beijing to Sam, with the content exceeding 1000 words as requested. The essay is written entirely in English without any Chinese translation or unnecessary punctuation marks in the body of the text.Beijing, the capital city of China, is a vibrant and dynamic metropolis that offers a unique blend of ancient history and modern development. As your friend, I am excited to introduce you to this captivating city and share with you the many wonders it has to offer.Let's begin our journey by exploring the rich cultural heritage of Beijing. The city is home to numerous iconic landmarks that serve as a testament to China's long and illustrious history. One of the most renowned sites is the Forbidden City, a vast and imposing palace complex that was once the exclusive domain of the Chinese emperors. As you wander through its intricate courtyards and grand halls, you'll be transported back in time, marveling at the exquisite architecture and the stories it holds.Another must-visit destination is the Temple of Heaven, a stunning example of Ming dynasty architecture. This sacred site was once thelocation where the emperor would perform annual rituals and ceremonies to ensure a bountiful harvest for the nation. The temple's intricate design, with its distinctive circular and square shapes, is a masterpiece of traditional Chinese architecture.Of course, no visit to Beijing would be complete without a stroll along the Great Wall of China. This iconic structure, which stretches for thousands of miles across the northern regions of the country, is a true wonder of the world. As you climb the steep steps and gaze out over the undulating landscape, you'll be struck by the sheer scale and engineering feat that went into its construction. It's a humbling and awe-inspiring experience that will leave you with a deeper appreciation for China's rich history and the ingenuity of its people.Beyond the historical landmarks, Beijing is also a city that embraces modernity and innovation. The skyline is dotted with towering skyscrapers, housing the headquarters of multinational corporations and cutting-edge technology companies. The city's infrastructure is constantly evolving, with an efficient public transportation system that includes a world-class subway network and a growing number of electric vehicles.One of the most fascinating aspects of Beijing is its vibrant food culture. The city is a culinary melting pot, offering a dizzying array of regional cuisines from across China. From the delicate flavors ofCantonese dim sum to the bold and spicy Sichuan dishes, there's something to satisfy every palate. And don't forget to try the local specialty, Peking duck, a dish that has become synonymous with Beijing's gastronomic heritage.As you explore the city, you'll also be struck by the dynamic and ever-changing nature of Beijing's cultural scene. The city is a hub for the arts, with world-class museums, art galleries, and performance venues showcasing the best of Chinese and international talent. From traditional Chinese opera to cutting-edge contemporary dance, there's always something new and exciting to discover.One of the most unique aspects of Beijing is its vibrant street life. The city is alive with the energy of its people, who can be found bustling through the narrow alleyways, known as hutongs, or gathered in public spaces for lively discussions, tai chi practice, or simply enjoying the outdoors. It's in these moments that you'll truly get a sense of the local culture and the rhythm of daily life in Beijing.Of course, no visit to Beijing would be complete without experiencing the city's famous shopping districts. From the bustling markets of Wangfujing to the high-end boutiques of Sanlitun, there's something for every taste and budget. Whether you're looking for traditional Chinese handicrafts, the latest fashion trends, or cutting-edge technology, Beijing has it all.As you can see, Beijing is a city that offers a rich and diverse experience for visitors. From its ancient history to its modern marvels, there is always something new to discover. Whether you're interested in culture, cuisine, or simply immersing yourself in the vibrant energy of the city, Beijing is a destination that will leave a lasting impression on you.I hope that this introduction has given you a glimpse of the many wonders that await you in Beijing. I encourage you to start planning your trip and to let me know if you have any questions or need any further recommendations. I can't wait to hear about your experiences and to share in the excitement of your journey to this incredible city.。
小学下册L卷英语第1单元期末试卷

小学下册英语第1单元期末试卷英语试题一、综合题(本题有100小题,每小题1分,共100分.每小题不选、错误,均不给分)1.I want to _______ (学习)做饭。
2.The process of separating liquids by their boiling points is called _____.3.My dad is a wonderful __________ (鼓励者).4.Chemical properties describe how a substance reacts with ______.5.The first successful manned mission to the moon was ________ (阿波罗11号).6.What is the capital of the United Kingdom?A. LondonB. EdinburghC. CardiffD. Belfast7.What is the main purpose of a computer?A. To eatB. To writeC. To computeD. To draw8.The _____ (rhubarb) needs special care.9.The _____ (cup/plate) is on the table.10.What is the term for a young bat?A. PupB. KitC. CalfD. CubA11.The chemical formula for boric acid is ______.12.ts can ______ (对抗) diseases effectively. Some pla13. A __________ (种植技巧) can improve yields.14.The food is _______ (美味的).15.What do you call the natural satellite of Earth?A. MarsB. VenusC. MoonD. Sun16.What do we call the celebration of the new year in China?A. DiwaliB. RamadanC. Lunar New YearD. Christmas17.Which planet is known for its rings?A. JupiterB. SaturnC. NeptuneD. Uranus18.What is the main ingredient in pancakes?A. FlourB. SugarC. ButterD. Eggs19.The ________ (experience) was unforgettable.20.We have a ______ (精彩的) event planned for this weekend.21.Which of these is a type of fruit?A. PotatoB. BeanC. PeachD. LettuceC22.The chemical formula for table sugar is ________.23.The first successful organ donation was performed in ________.24.It is ________ outside today.25.How many colors are there in a rainbow?A. 5B. 6C. 7D. 8C26.I like to _____ with my friends. (hang out)27.The boy plays the ________.28.Dolphins are very _______ animals.29.The blue jay is a type of _________. (鸟)30.Some _______ are known for their vibrant colors.31.They are ___ a movie. (watching)32. A solution can become saturated when it contains a solid that will not ______.33.I like to eat ___ (vegetables).34. A goat climbs _______ and rocky hills easily.35.The tallest mountain in the world is __________.36.What do we call a person who studies the anatomy of the human body?A. AnatomistB. BiologistC. PhysiologistD. PathologistA37.My uncle is a ______. He loves to tell jokes.38.What do we use to measure time?A. RulerB. ClockC. ScaleD. TapeB39.The __________ (历史的连接) builds relationships.40.What is the largest planet in our solar system?A. EarthB. MarsC. JupiterD. Saturn答案:C41.My ________ (玩具名称) is made of wood.42.I enjoy playing __________ with my sister. (棋盘游戏)43.She is a ________ student.44.I feed my cat ______ (鱼) every day.45.The cat is ___ the tree. (in)46.ts have a tough ______ (外壳). Some gar47.The ______ (水源) is vital for plant health.48.The cake is ________ for my birthday.49.What color is the sun?A. BlueB. YellowC. GreenD. Red50.What do you call a young sheep?A. CalfB. LambC. KidD. Foal51.The weather is ________ today.52.I can ________ the piano.53.I enjoy ___ (painting) with watercolors.54.The _____ (pollen) is carried by the wind.55.The dog is ___ by the fence. (lying)56.My friend plays in the school ____ (orchestra).57.The chemical formula for bismuth trioxide is _____.58.What do we call the center of an atom?A. NucleusB. ElectronC. ProtonD. NeutronA59.We will _______ (camp) under the stars.60.The __________ can reveal evidence of ancient volcanic activity.61.古代的________ (temples) 通常是宗教活动的中心。
Mac系统的文本编辑器推荐

Mac系统的文本编辑器推荐在日常生活和工作中,我们经常需要使用文本编辑器来处理各种文本文件。
对于Mac系统的用户来说,选择一个合适的文本编辑器非常重要,因为它能够影响我们的工作效率和使用体验。
在本文中,我将为您推荐几款在Mac系统上使用的优秀文本编辑器。
1. TextMateTextMate是一款非常受欢迎的文本编辑器,它提供了丰富的功能和高度可定制性。
TextMate支持多种语言的语法高亮显示,代码折叠,自动完成等功能,使得编码工作更加方便和高效。
此外,TextMate还支持插件的安装和配置,用户可以根据自己的需求定制编辑器的功能和外观。
2. Sublime TextSublime Text是目前为止最受欢迎的文本编辑器之一,无论是初学者还是专业人士都可以通过Sublime Text轻松地进行编码工作。
Sublime Text具有快速响应的编辑器速度、灵活的多光标编辑和强大的宏功能等特点。
此外,Sublime Text还支持丰富的插件生态系统,用户可以通过安装插件来扩展编辑器的功能。
3. AtomAtom是由GitHub开发的一款现代化的开源文本编辑器。
Atom具有直观的界面,丰富的主题和插件,以及可高度定制的编辑器设置。
Atom支持Git版本控制,内置了强大的搜索和替换功能,并且还有一个活跃的社区,用户可以在社区中分享主题、插件和代码片段。
4. Visual Studio CodeVisual Studio Code是一款由微软开发的免费开源的文本编辑器。
虽然它的名字中带有"code",但实际上它是一个功能强大的编辑器,支持多种编程语言,并且具有智能代码完成、调试、Git集成等功能。
Visual Studio Code还支持丰富的插件扩展,并且有一个活跃的社区,用户可以分享插件和主题。
5. BBEditBBEdit是一款经典的文本编辑器,适用于Mac系统。
它具有简洁、直观的界面,支持多种编码和语法高亮显示。
程序编辑的必备工具文本编辑器推荐

程序编辑的必备工具文本编辑器推荐文本编辑器是程序编辑的必备工具之一。
它为程序员提供了一个便捷且高效的环境,用于编辑、调试和管理代码。
在选择适合自己的文本编辑器时,往往需要考虑诸多因素,如界面友好度、功能强大程度、插件扩展性以及跨平台兼容性等。
下面将为大家推荐几款优秀的文本编辑器,帮助程序员提高开发效率。
一、Sublime TextSublime Text是一款强大且流行的文本编辑器,被广大程序员所喜爱。
它提供了简洁的界面和丰富的功能,支持多种编程语言的语法高亮、自动补全和宏命令等。
Sublime Text还支持插件扩展,可以根据个人需求进行定制。
其跨平台特性使得程序员可以在不同操作系统上进行开发,极大地提高了开发效率。
二、Visual Studio CodeVisual Studio Code是由微软推出的一款轻量级代码编辑器,其功能强大、易于使用,并且拥有丰富的插件生态系统。
Visual Studio Code支持多种编程语言,提供了智能代码补全、调试、版本控制等功能,使得程序员能够更加高效地进行开发。
它还具有丰富的主题可供选择,可以个性化编辑器的外观。
三、AtomAtom是GitHub开发的一款开源文本编辑器,被誉为“21世纪的编辑器”。
它具有可定制化的界面、快速的性能和丰富的插件生态系统。
Atom支持多种编程语言,提供了代码片段、文件目录树、项目管理等实用功能。
同时,Atom还具有Git和GitHub的集成,方便程序员进行代码版本管理。
四、Notepad++Notepad++是一款免费的文本编辑器,适用于Windows环境。
尽管它的功能相对较简单,但Notepad++提供了语法高亮、代码折叠、宏命令等功能,足以满足大部分程序员的需求。
在开发小型项目或进行简单的代码编辑时,Notepad++是一个不错的选择。
五、VimVim是一款老牌而强大的文本编辑器,它具有丰富的特性和高度可定制性。
Vim支持多种操作模式和快捷键,让用户能够快速编辑和导航代码。
如何询问稿件及编辑答复

如何询问稿件及编辑答复!Dear Editor,I'm not sure if it is the right time to contact you again to inquire about the status of my submittedmanuscript(ref:****) although nearly one month have passed since I contacted you last time. Iwould be greatly appreciate ifyou could spend some of your time check the status for me.Best regards***老外的答复:Dear ***,Thank you for your e-mail. We would like to sincerely apologise for the long delay in reviewingyour article. Your article was sent to many different referees, most of whom felt that they wereeither unqualified or their time was too restricted to review the paper. We understand that youmust feel frustrated, and we are sorry for this. Please understand that we rely entirely on thereferee‟s to return articles to us sp eedily. Unfortunately, this is not always the case. It would bemuch appreciated if you could suggest an alternative referee for your article, a person who may beable to review the article in a more appropriate time frame. Please forward this person's contactdetails (e-mail address) to us as soon as possible. We will do our very best to speed up the process.We apologize for any inconvenience that you experienced due to this delay, and we appreciateyour understanding and tried patience in this regard.邀请函上没有老外签名,无法签证背景介绍:老外的签名跟我们的盖章查不多,没有签名的东西是不正式的,我去参加某次国际会议,签证的时候才发现,粗心的老外给我的邀请函没有他的签名,我只好email 给她询问,并要求马上传真给我。
textmate使用技巧

textmate使用技巧摘要:1.文本简介2.常用快捷键3.高级功能与应用4.个性化设置5.结论正文:文本简介TextMate是一款功能强大的文本编辑器,广泛应用于编程、写作等领域。
它具有丰富的快捷键、高级功能和个性化设置,为用户提供高效、舒适的办公体验。
本文将介绍TextMate的使用技巧,帮助大家充分发挥这款编辑器的潜力。
常用快捷键1.基本编辑:- Ctrl + N:打开文件- Ctrl + S:保存文件- Ctrl + X:剪切文本- Ctrl + C:复制文本- Ctrl + V:粘贴文本2.选择文本:- Shift + 方向键:矩形选择文本- Alt + 方向键:列选择文本- Ctrl + Shift + 方向键:扩展选择文本3.搜索与替换:- Ctrl + F:查找文本- Ctrl + R:替换文本- Ctrl + G:跳转到指定行高级功能与应用1.代码折叠:TextMate支持代码折叠功能,可以让代码结构更加清晰,提高阅读效率。
2.自动补全:编写代码时,TextMate会根据已输入的代码自动补全变量、函数名等,减少输入错误。
3.语法高亮:根据文本语言的不同,TextMate会自动为代码添加不同的颜色,便于识别。
4.集成终端:TextMate内置终端,方便用户在编辑器中执行命令和调试代码。
5.插件扩展:TextMate有丰富的插件库,可以根据个人需求进行安装,提升编辑器功能。
个性化设置1.主题:TextMate支持多种主题,可以根据个人喜好进行选择。
2.字体:用户可以自定义字体、字号和行间距,以达到最佳的视觉效果。
3.快捷键自定义:可以根据个人习惯自定义快捷键,提高操作效率。
4.设置文件:在TextMate的设置文件中,可以对编辑器的各种参数进行调整。
结论TextMate是一款功能丰富、易于掌握的文本编辑器。
通过掌握本文介绍的常用技巧,相信大家能够更加高效地使用TextMate,提升工作和学习效率。
小学上册第14次英语第二单元全练全测

小学上册英语第二单元全练全测英语试题一、综合题(本题有100小题,每小题1分,共100分.每小题不选、错误,均不给分)1.I think it’s fun to go ________ (参加讲座).2. e of Hastings took place in ________. The Batt3.My favorite ___ (小动物) is the rabbit.4.What do we call the study of human societies and cultures?A. AnthropologyB. SociologyC. PsychologyD. GeographyA5.What color do you get when you mix red and white?A. PinkB. PurpleC. BrownD. OrangeA6.The _______ can be a great way to bond with family.7.The chemical formula for glucose is __________.8.What do we call the person who writes books?A. AuthorB. EditorC. PublisherD. Reader9.What is the name of the famous detective created by Arthur Conan Doyle?A. Hercule PoirotB. Sam SpadeC. Sherlock HolmesD. Miss MarpleC10.The ancient civilizations of Mesopotamia were located between the ________ and Tigris rivers.11.The study of rocks can reveal information about the Earth's ______.12.My favorite book is ______.13.My pet ______ (狗) loves to fetch sticks.14.The ________ was a significant leader in the labor movement.15.In spring, the ________ (花朵) bloom and the ________ (树叶) grow green.16.What do you call a journey to space?A. TravelB. ExpeditionC. VoyageD. MissionD17.What is the process of water changing into vapor called?A. CondensationB. EvaporationC. PrecipitationD. InfiltrationB18.The boy plays the ________.19.She has a ________ for her birthday.20.Vegetables like carrots grow _____ (在地下).21.I can ______ (jump) very high.22.I have a ________ (魔方) that I try to solve every day.23.What do we call the part of the plant that makes seeds?A. LeafB. FlowerC. StemD. RootB24. A _______ (小鹰) soars high above the mountains.25.He is very _____ (热情) about his work.26.His favorite color is ________.27.Who wrote "Romeo and Juliet"?A. Charles DickensB. Mark TwainC. William ShakespeareD. J.K. RowlingC28.How many legs does a spider have?A. FourB. SixC. EightD. Ten29.I like to make ______ for my classmates.30.We have a ______ (有趣的) teacher.31.What color is the planet Mars often associated with?A. BlueB. GreenC. RedD. Yellow32. A ______ has a unique pattern on its fur.33.I can ______ (画) a picture of my family.34.What is the sound a dog makes?A. MeowB. BarkC. MooD. Quack35. A __________ is a type of animal known for its loyalty to humans.36.How many months have 28 days?A. 1B. 2C. 12D. 037.My mom, ______ (我妈妈), is very kind.38.The capital of Georgia is _______.39.The formula for glucose is _____.40.He is _____ (tall/short) than his sister.41.The tortoise is known for its _________. (耐心)42. A rabbit loves to ______ (跳) around in the grass.43.The ______ (蓝色) flower is rare.44.The stars are ___ (twinkling/shining).45.I enjoy visiting historical sites to learn about __________.46.What do you use to write on paper?A. BrushB. PencilC. KnifeD. SpoonB47.What do you call a group of birds?A. FlockB. SchoolC. PackD. Colony48.The chemical symbol for potassium is ________.49.The ancient Chinese invented _____ paper.50.The sun is _______ (shining) on the water.51.What is the capital city of Mexico?A. CancunB. GuadalajaraC. TijuanaD. Mexico CityD52.I want to plant ________ in my bedroom.53.What is the name of the famous Egyptian queen?A. CleopatraB. NefertitiC. HatshepsutD. IsisA54.The ________ (乡村风光) is picturesque.55.The chemical symbol for hafnium is __________.56.The frog's legs are _______ (强壮) for jumping.57.I need to ______ my teeth after eating. (brush)58.What do we call the time of day when the sun rises?A. MorningB. EveningC. NightD. AfternoonA59. A __________ is a large-scale geological event.60.The _____ (运动) is exciting.61. A __________ has a distinctive call that sounds like a laugh.62.environmental ethics) guide personal and societal responsibility. The ____63.Where does Santa Claus live?A. North PoleB. South PoleC. New YorkD. LondonA64.I want to _______ a story about adventures.65.The _______ (Berlin Wall) was built to separate East and West Berlin.66.What do we call a baby deer?A. FawnB. CalfC. KidD. LambA67.What is the opposite of light?A. DarkB. HeavyC. BrightD. All of the aboveA68.My aunt is a ______. She enjoys cooking.69. A chemist studies the properties and ________ of matter.70.She has a ___ (happy/sad) face.71.What do we call the place where we watch movies?A. TheaterB. MuseumC. LibraryD. ParkA72.What do you call the outer layer of the Earth?A. MantleB. CrustC. CoreD. BedrockB73.I want to _______ (学习) about different cultures.74.My brother likes to learn about ____ (history).75.How do you say "hello" in Spanish?A. BonjourB. CiaoC. HolaD. Olá76.What do we call the study of the mind and behavior?A. SociologyB. PsychologyC. PsychiatryD. NeurologyB Psychology77.ts have adapted to thrive in nutrient-poor ______. (某些植物已适应在养分贫乏的土壤中生存。
amis-editor 用法

amis-editor用法amis-editor是一款功能强大的文本编辑器,具有语法高亮、代码折叠、自动补全等功能,适合开发人员使用。
本文将介绍amis-editor的基本用法,帮助您快速上手。
一、安装amis-editor首先,您需要下载并安装amis-editor。
可以从官方网站或软件下载网站上获取安装包,按照提示进行安装即可。
二、打开amis-editor安装完成后,打开amis-editor,您将会看到一个简洁的界面。
在界面左侧,您可以找到各种编辑器功能按钮,如新建文件、打开文件、保存文件、另存为等。
三、创建和编辑代码在amis-editor中,您可以创建和编辑各种类型的代码,如HTML、CSS、JavaScript等。
在编辑器中输入代码后,可以点击左侧的功能按钮对代码进行高亮显示和语法检查。
四、代码折叠和自动补全amis-editor提供了代码折叠功能,方便您查看和管理代码块。
同时,编辑器还具有自动补全功能,可以帮助您快速输入代码。
在输入代码时,编辑器会自动提示可能的补全选项,您可以选择所需的选项进行输入。
五、保存和导出代码在amis-editor中编写完代码后,需要将其保存到本地或导出为其他格式的文件。
您可以使用编辑器中的保存功能将代码保存到本地磁盘上,或者将代码导出为其他格式的文件,如文本文件、HTML文件等。
六、常用快捷键amis-editor提供了丰富的快捷键,方便您快速操作编辑器。
以下是一些常用的快捷键:*Ctrl+S:保存文件*Ctrl+O:打开文件*Ctrl+N:新建文件*Ctrl+X:剪切选中的文本*Ctrl+C:复制选中的文本*Ctrl+V:粘贴文本*Ctrl+Alt+U:全屏/退出全屏*Ctrl+Alt+J:代码高亮/反高亮七、其他功能和注意事项amis-editor还具有一些其他实用的功能和注意事项,如保存为模板、备份和还原文件等。
在使用amis-editor时,请务必注意保存和备份重要文件,以防意外丢失。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
The Text Editor samROB PIKEAT&T Bell LaboratoriesMurray Hill, New Jersey 07974ABSTRACTSam is an interactive multi-file text editor intended for bitmap displays. A textual com-mand language supplements the mouse-driven, cut-and-paste interface to make complexor repetitive editing tasks easy to specify. The language is characterized by the composi-tion of regular expressions to describe the structure of the text being modified. The treat-ment of files as a database, with changes logged as atomic transactions, guides the imple-mentation and makes a general ‘undo’ mechanism straightforward.Sam is implemented as two processes connected by a low-bandwidth stream, one process handling the display and the other the editing algorithms. Therefore it can runwith the display process in a bitmap terminal and the editor on a local host, with both pro-cesses on a bitmap-equipped host, or with the display process in the terminal and the edi-tor in a remote host. By suppressing the display process, it can even run without a bitmapterminal.This paper is reprinted from Software—Practice and Experience, Vol 17, number 11, pp. 813-845.KEY WORDS Text editors Caches Regular expressions UndoIntroductionSam is an interactive text editor that combines cut-and-paste interactive editing with an unusual command language based on the composition of regular expressions. It is written as two programs: one, the ‘host part,’ runs on a Unix* system and implements the command language and provides file access; the other, the ‘terminal part,’ runs asynchronously on a machine with a mouse and bitmap display and supports the display and interactive editing. The host part may be even run in isolation on an ordinary terminal to edit text using the command language, much like a traditional line editor, without assistance from a mouse or display. Most often, the terminal part runs on a Blit1terminal (actually on a Teletype DMD 5620, the pro-duction version of the Blit), whose host connection is an ordinary 9600 bps RS232 link; on the Sun com-puter the host and display processes run on a single machine, connected by a pipe.Sam edits uninterpreted ASCII text. It has no facilities for multiple fonts, graphics or tables, unlike MacWrite,2Bravo,3Tioga4or Lara.5Also unlike them, it has a rich command language. (Throughout this paper, the phrase command language refers to textual commands; commands activated from the mouse form the mouse language.)Sam developed as an editor for use by programmers, and tries to join the styles of the Unix text editor ed6,7with that of interactive cut-and-paste editors by providing a comfortable mouse-driven interface to a program with a solid command language driven by regular expressions. The command language developed more than the mouse language, and acquired a notation for describing the structure of files more richly than as a sequence of lines, using a dataflow-like syntax for specifying changes.The interactive style was influenced by jim,1an early cut-and-paste editor for the Blit, and by mux,8 the Blit window system.Mux merges the original Blit window system,mpx,1with cut-and-paste editing, __________________* Unix is a registered trademark of AT&T.forming something like a multiplexed version of jim that edits the output of (and input to) command ses-sions rather than files.The first part of this paper describes the command language, then the mouse language, and explains how they interact. That is followed by a description of the implementation, first of the host part, then of the terminal part. A principle that influenced the design of sam is that it should have no explicit limits, such as upper limits on file size or line length. A secondary consideration is that it be efficient. To honor these two goals together requires a method for efficiently manipulating huge strings (files) without breaking them into lines, perhaps while making thousands of changes under control of the command language.Sam’s method is to treat the file as a transaction database, implementing changes as atomic updates. These updates may be unwound easily to ‘undo’ changes. Efficiency is achieved through a collection of caches that minimizes disc traffic and data motion, both within the two parts of the program and between them.The terminal part of sam is fairly straightforward. More interesting is how the two halves of the edi-tor stay synchronized when either half may initiate a change. This is achieved through a data structure that organizes the communications and is maintained in parallel by both halves.The last part of the paper chronicles the writing of sam and discusses the lessons that were learned through its development and use.The paper is long, but is composed largely of two papers of reasonable length: a description of the user interface of sam and a discussion of its implementation. They are combined because the implementa-tion is strongly influenced by the user interface, and vice versa.The InterfaceSam is a text editor for multiple files. File names may be provided when it is invoked:sam file1 file2 ...and there are commands to add new files and discard unneeded ones. Files are not read until necessary to complete some command. Editing operations apply to an internal copy made when the file is read; the Unix file associated with the copy is changed only by an explicit command. To simplify the discussion, the internal copy is here called a file, while the disc-resident original is called a disc file.Sam is usually connected to a bitmap display that presents a cut-and-paste editor driven by the mouse. In this mode, the command language is still available: text typed in a special window, called the sam window,is interpreted as commands to be executed in the current file. Cut-and-paste editing may be used in any window — even in the sam window to construct commands. The other mode of operation, invoked by starting sam with the option-d(for ‘no download’), does not use the mouse or bitmap display, but still permits editing using the textual command language, even on an ordinary terminal, interactively or from a script.The following sections describe first the command language (under sam -d and in the sam win-dow), and then the mouse interface. These two languages are nearly independent, but connect through the current text,described below.The Command LanguageA file consists of its contents, which are an array of characters (that is, a string); the name of the associated disc file; the modified bit that states whether the contents match those of the disc file; and a substring of the contents, called the current text or dot(see Figures 1 and 2). If the current text is a null string, dot falls between characters. The value of dot is the location of the current text; the contents of dot are the charac-ters it contains.Sam imparts to the text no two-dimensional interpretation such as columns or fields; text is always one-dimensional. Even the idea of a ‘line’ of text as understood by most Unix programs — a sequence of characters terminated by a newline character — is only weakly supported.The current file is the file to which editing commands refer. The current text is therefore dot in the current file. If a command doesn’t explicitly name a particular file or piece of text, the command is assumed to apply to the current text. For the moment, ignore the presence of multiple files and consider editing a single file.Commands have one-letter names. Except for non-editing commands such as writing the file to disc,Figure 1. A typical sam screen, with the editing menu presented. The sam(command language) window is in the middle, with file windows above and below. (The user interface makes it easy to create these abutting windows.) The partially obscured window is a third file window. The uppermost window is that to which typing and mouse operations apply, as indicated by its heavy border. Each window has its current text highlighted in reverse video. The sam window’s current text is the null string on the last visible line, indi-cated by a vertical bar. See also Figure 2.most commands make some change to the text in dot and leave dot set to the text resulting from the change. For example, the delete command,d, deletes the text in dot, replacing it by the null string and setting dot to the result. The change command,c, replaces dot by text delimited by an arbitrary punctuation character, conventionally a slash. Thus,c/Peter/replaces the text in dot by the string Peter. Similarly,a/Peter/(append) adds the string after dot, andi/Peter/(insert) inserts before dot. All three leave dot set to the new text,Peter.Newlines are part of the syntax of commands: the newline character lexically terminates a command. Within the inserted text, however, newlines are never implicit. But since it is often convenient to insert multiple lines of text,sam has a special syntax for that case:asome lines of textto be inserted in the file,terminated by a periodon a line by itself.In the one-line syntax, a newline character may be specified by a C-like escape, soc/\n/replaces dot by a single newline character.Sam also has a substitute command,s:s/expression/replacement/substitutes the replacement text for the first match, in dot, of the regular expression. Thus, if dot is the string Peter, the commands/t/st/changes it to Pester. In general,s is unnecessary, but it was inherited from ed and it has some conve-nient variations. For instance, the replacement text may include the matched text, specified by&: s/Peter/Oh, &, &, &, &!/There are also three commands that apply programs to text:<Unix programreplaces dot by the output of the Unix program. Similarly, the>command runs the program with dot as its standard input, and|does both. For example,| sortreplaces dot by the result of applying the standard sorting utility to it. Again, newlines have no special sig-nificance for these sam commands. The text acted upon and resulting from these commands is not neces-sarily bounded by newlines, although for connection with Unix programs, newlines may be necessary to obey conventions.One more command:p prints the contents of dot. Table I summarizes sam’s commands.The value of dot may be changed by specifying an address for the command. The simplest address is a line number:3refers to the third line of the file, so3ddeletes the third line of the file, and implicitly renumbers the lines so the old line 4 is now numbered 3. (This is one of the few places where sam deals with lines directly.) Line0is the null string at the begin-ning of the file. If a command consists of only an address, a p command is assumed, so typing an unadorned3prints line 3 on the terminal. There are a couple of other basic addresses: a period addresses dot itself; and a dollar sign ($) addresses the null string at the end of the file.An address is always a single substring of the file. Thus, the address3addresses the characters after the second newline of the file through the third newline of the file. A compound address is constructed by the comma operatoraddress1,address2and addresses the substring of the file from the beginning of address1to the end of address2. For example, the command3,5p prints the third through fifth lines of the file and.,$d deletes the text from the begin-ning of dot to the end of the file.These addresses are all absolute positions in the file, but sam also has relative addresses, indicated by +or-. For example,$-3is the third line before the end of the file and.+1is the line after dot. If no address appears to the left of the+or-, dot is assumed; if nothing appears to the right,1is assumed. Therefore,.+1may be abbreviated to just a plus sign.The+operator acts relative to the end of its first argument, while the-operator acts relative to the beginning. Thus.+1addresses the first line after dot,.-addresses the first line before dot, and+-refersTable I.Sam commands_ ________________________________________________________________________Text commands_ ________________________________________________________________________ a/text/Append text after dotc/text/Change text in doti/text/Insert text before dotd Delete text in dots/regexp/text/Substitute text for match of regular expression in dotm address Move text in dot after addresst address Copy text in dot after address_ ________________________________________________________________________Display commands_ ________________________________________________________________________ p Print contents of dot=Print value (line numbers and character numbers) of dot_ ________________________________________________________________________File commands_ ________________________________________________________________________b file-list Set current file to first file in list that sam has in menuB file-list Same as b, but load new filesn Print menu lines of all filesD file-list Delete named files from sam_ ________________________________________________________________________I/O commands_ ________________________________________________________________________ e filename Replace file with named disc filer filename Replace dot by contents of named disc filew filename Write file to named disc filef filename Set file name and print new menu line<Unix-command Replace dot by standard output of command>Unix-command Send dot to standard input of command|Unix-command Replace dot by result of command applied to dot!Unix-command Run the command_ ________________________________________________________________________Loops and conditionals_ ________________________________________________________________________ x/regexp/command For each match of regexp, set dot and run commandy/regexp/command Between adjacent matches of regexp, set dot and run command X/regexp/command Run command in each file whose menu line matches regexpY/regexp/command Run command in each file whose menu line does not matchg/regexp/command If dot contains a match of regexp, run commandv/regexp/command If dot does not contain a match of regexp, run command_ ________________________________________________________________________Miscellany_ ________________________________________________________________________ k Set address mark to value of dotq Quitu n Undo last n(default 1) changes{ }Braces group commands_ ________________________________________________________________________to the line containing the end of dot. (Dot may span multiple lines, and+selects the line after the end of dot, then-backs up one line.)The final type of address is a regular expression, which addresses the text matched by the expression. The expression is enclosed in slashes, as in/expression/The expressions are the same as those in the Unix program egrep,6,7and include closures, alternations, and so on. They find the leftmost longest string that matches the expression, that is, the first match after the point where the search is started, and if more than one match begins at the same spot, the longest such match. (I assume familiarity with the syntax for regular expressions in Unix programs.9) For example, /x/matches the next x character in the file,/xx*/matches the next run of one or more x’s, and/x|Peter/matches the next x or Peter. For compatibility with other Unix programs, the ‘any character’ operator, a period, does not match a newline, so/.*/matches the text from dot to the end of the line, but excludes the newline and so will not match across the line boundary.Regular expressions are always relative addresses. The direction is forwards by default, so /Peter/is really an abbreviation for+/Peter/. The search can be reversed with a minus sign, so -/Peter/finds the first Peter before dot. Regular expressions may be used with other address forms, so 0+/Peter/finds the first Peter in the file and$-/Peter/finds the last. Table II summarizes sam’s addresses.The language discussed so far will not seem novel to people who use Unix text editors such as ed or vi.9Moreover, the kinds of editing operations these commands allow, with the exception of regular expres-sions and line numbers, are clearly more conveniently handled by a mouse-based interface. Indeed,sam’s mouse language (discussed at length below) is the means by which simple changes are usually made. For large or repetitive changes, however, a textual language outperforms a manual interface.Imagine that, instead of deleting just one occurrence of the string Peter, we wanted to eliminate every Peter. What’s needed is an iterator that runs a command for each occurrence of some text.Sam’s iterator is called x, for extract:x/expression/commandfinds all matches in dot of the specified expression, and for each such match, sets dot to the text matched and runs the command. So to delete all the Peters:0,$ x/Peter/ d(Blanks in these examples are to improve readability;sam neither requires nor interprets them.) This searches the entire file (0,$) for occurrences of the string Peter, and runs the d command with dot set to each such occurrence. (By contrast, the comparable ed command would delete all lines containing Peter; sam deletes only the Peters.) The address0,$is commonly used, and may be abbreviated to just a comma. As another example,, x/Peter/ pprints a list of Peters,one for each appearance in the file, with no intervening text (not even newlines to separate the instances).Table II.Sam addresses_ _________________________________________________________________Simple addresses_ _________________________________________________________________#n The empty string after character nn Line n./regexp/The first following match of the regular expression-/regexp/The first previous match of the regular expression$The null string at the end of the file.Dot’The address mark, set by k command"regexp"Dot in the file whose menu line matches regexp_ _________________________________________________________________Compound addresses_ _________________________________________________________________a1+a2The address a2evaluated starting at right of a1a1-a2 a2evaluated in the reverse direction starting at left of a1a1,a2From the left of a1to the right of a2(default0,$)a1;a2Like,but sets dot after evaluating a1_ _________________________________________________________________The operators+and-are high precedence, while,and;are lowprecedence. In both+and-forms,a2defaults to 1 and a1defaults todot. If both a1and a2are present,+may be elided._ _________________________________________________________________Of course, the text extracted by x may be selected by a regular expression, which complicates decid-ing what set of matches is chosen — matches may overlap. This is resolved by generating the matches starting from the beginning of dot using the leftmost-longest rule, and searching for each match starting from the end of the previous one. Regular expressions may also match null strings, but a null match adja-cent to a non-null match is never selected; at least one character must intervene. For example, , c/AAA/x/B*/ c/-/, pproduces as output-A-A-A-because the pattern B*matches the null strings separating the A’s.The x command has a complement,y, with similar syntax, that executes the command with dot set to the text between the matches of the expression. For example,, c/AAA/y/A/ c/-/, pproduces the same result as the example above.The x and y commands are looping constructs, and sam has a pair of conditional commands to go with them. They have similar syntax:g/expression/command(guard) runs the command exactly once if dot contains a match of the expression. This is different from x, which runs the command for each match:x loops;g merely tests, without changing the value of dot. Thus, , x/Peter/ ddeletes all occurrences of Peter, but, g/Peter/ ddeletes the whole file (reduces it to a null string) if Peter occurs anywhere in the text. The complemen-tary conditional is v, which runs the command if there is no match of the expression.These control-structure-like commands may be composed to construct more involved operations. For example, to print those lines of text that contain the string Peter:, x/.*\n/ g/Peter/ pThe x breaks the file into lines, the g selects those lines containing Peter, and the p prints them. This command gives an address for the x command (the whole file), but because g does not have an explicit address, it applies to the value of dot produced by the x command, that is, to each line. All commands in sam except for the command to write a file to disc use dot for the default address.Composition may be continued indefinitely., x/.*\n/ g/Peter/ v/SaltPeter/ pprints those lines containing Peter but not those containing SaltPeter.Structural Regular ExpressionsUnlike other Unix text editors, including the non-interactive ones such as sed and awk,7sam is good for manipulating files with multi-line ‘records.’ An example is an on-line phone book composed of records, separated by blank lines, of the formHerbert Tic44 Turnip Ave., Endive, NJ201-5555642Norbert Twinge16 Potato St., Cabbagetown, NJ201-5553145...The format may be encoded as a regular expression:(.+\n)+that is, a sequence of one or more non-blank lines. The command to print Mr. Tic’s entire record is then , x/(.+\n)+/ g/ˆHerbert Tic$/ pand that to extract just the phone number is, x/(.+\n)+/ g/ˆHerbert Tic$/ x/ˆ[0-9]*-[0-9]*\n/ pThe latter command breaks the file into records, chooses Mr. Tic’s record, extracts the phone number from the record, and finally prints the number.A more involved problem is that of renaming a particular variable, say n, to num in a C program. The obvious first attempt,, x/n/ c/num/is badly flawed: it changes not only the variable n but any letter n that appears. We need to extract all the variables, and select those that match n and only n:, x/[A-Za-z_][A-Za-z_0-9]*/ g/n/ v/../ c/num/The pattern[A-Za-z_][A-Za-z_0-9]*matches C identifiers. Next g/n/selects those containing an n. Then v/../rejects those containing two (or more) characters, and finally c/num/changes the remainder (identifiers n) to num. This version clearly works much better, but there may still be problems. For example, in C character and string constants, the sequence\n is interpreted as a newline character, and we don’t want to change it to\num.This problem can be forestalled with a y command:, y/\\n/ x/[A-Za-z_][A-Za-z_0-9]*/ g/n/ v/../ c/num/(the second\is necessary because of lexical conventions in regular expressions), or we could even reject character constants and strings outright:, y/’[ˆ’]*’/ y/"[ˆ"]*"/ x/[A-Za-z_][A-Za-z_0-9]*/ g/n/ v/../ c/num/The y commands in this version exclude from consideration all character constants and strings. The only remaining problem is to deal with the possible occurrence of\’or\"within these sequences, but it’s easy to see how to resolve this difficulty.The point of these composed commands is successive refinement. A simple version of the command is tried, and if it’s not good enough, it can be honed by adding a clause or two. (Mistakes can be undone; see below. Also, the mouse language makes it unnecessary to retype the command each time.) The result-ing chains of commands are somewhat reminiscent of shell pipelines.7Unlike pipelines, though, which pass along modified data,sam commands pass a view of the data. The text at each step of the command is the same, but which pieces are selected is refined step by step until the correct piece is available to the final step of the command line, which ultimately makes the change.In other Unix programs, regular expressions are used only for selection, as in the sam g command, never for extraction as in the x or y command. For example, patterns in awk7are used to select lines to be operated on, but cannot be used to describe the format of the input text, or to handle newline-free text. The use of regular expressions to describe the structure of a piece of text rather than its contents, as in the x command, has been given a name:structural regular expressions.When they are composed, as in the above example, they are pleasantly expressive. Their use is discussed at greater length elsewhere.10 Multiple filesSam has a few other commands, mostly relating to input and output.e discfilenamereplaces the contents and name of the current file with those of the named disc file;w discfilenamewrites the contents to the named disc file; andr discfilenamereplaces dot with the contents of the named disc file. All these commands use the current file’s name if none is specified. Finally,f discfilenamechanges the name associated with the file and displays the result:’-. discfilenameThis output is called the file’s menu line,because it is the contents of the file’s line in the button 3 menu (described in the next section). The first three characters are a concise notation for the state of the file. The apostrophe signifies that the file is modified. The minus sign indicates the number of windows open on the file (see the next section):-means none,+means one, and*means more than one. Finally, the period indicates that this is the current file. These characters are useful for controlling the X command, described shortly.Sam may be started with a set of disc files (such as all the source for a program) by invoking it with a list of file names as arguments, and more may be added or deleted on demand.B discfile1 discfile2 ...adds the named files to sam’s list, andD discfile1 discfile2 ...removes them from sam’s memory (without effect on associated disc files). Both these commands have asyntax for using the shell7(the Unix command interpreter) to generate the lists:B <echo *.cwill add all C source files, andB <grep -l variable *.cwill add all C source files referencing a particular variable (the Unix command grep -l lists all files in its arguments that contain matches of the specified regular expression). Finally,D without arguments deletes the current file.There are two ways to change which file is current:b filenamemakes the named file current. The B command does the same, but also adds any new files to sam’s list. (In practice, of course, the current file is usually chosen by mouse actions, not by textual commands.) The other way is to use a form of address that refers to files:"expression"addressrefers to the address evaluated in the file whose menu line matches the expression (there must be exactly one match). For example,"peter.c" 3refers to the third line of the file whose name matches peter.c. This is most useful in the move (m) and copy (t) commands:0,$ t "peter.c" 0makes a copy of the current file at the beginning of peter.c.The X command is a looping construct, like x, that refers to files instead of strings:X/expression/commandruns the command in all files whose menu lines match the expression. The best example is X/’/ wwhich writes to disc all modified files.Y is the complement of X: it runs the command on all files whose menu lines don’t match the expression:Y/\.c/ Ddeletes all files that don’t have.c in their names, that is, it keeps all C source files and deletes the rest.Braces allow commands to be grouped, so{command1command2}is syntactically a single command that runs two commands. Thus,X/\.c/ ,g/variable/ {f, x/.*\n/ g/variable/ p}finds all occurrences of variable in C source files, and prints out the file names and lines of each match. The precise semantics of compound operations is discussed in the implementation sections below.Finally, the undo command,u, undoes the last command, no matter how many files were affected. Multiple undo operations move further back in time, so。