Contents 1 Keyboard and mouse macros 1.1 Application macros and scripting 1.1.1 Macro virus 2 Text-substitution macros 2.1 Embeddable languages 3 Procedural macros 4 Syntactic macros 4.1 Early Lisp macros 4.2 Anaphoric macros 4.3 Hygienic macros 4.4 Applications 5 Macros for machine-independent software 6 See also 7 References

Keyboard and mouse macros[edit] Keyboard macros and mouse macros allow short sequences of keystrokes and mouse actions to transform into other, usually more time-consuming, sequences of keystrokes and mouse actions. In this way, frequently used or repetitive sequences of keystrokes and mouse movements can be automated. Separate programs for creating these macros are called macro recorders. During the 1980s, macro programs – originally SmartKey, then SuperKey, KeyWorks, Prokey – were very popular, first as a means to automatically format screenplays, then for a variety of user input tasks. These programs were based on the TSR (terminate and stay resident) mode of operation and applied to all keyboard input, no matter in which context it occurred. They have to some extent fallen into obsolescence following the advent of mouse-driven user interface and the availability of keyboard and mouse macros in applications such as word processors and spreadsheets, making it possible to create application-sensitive keyboard macros. Keyboard macros have in more recent times come to life as a method of exploiting the economy of massively multiplayer online role-playing games (MMORPGs). By tirelessly performing a boring, repetitive, but low risk action, a player running a macro can earn a large amount of the game's currency or resources. This effect is even larger when a macro-using player operates multiple accounts simultaneously, or operates the accounts for a large amount of time each day. As this money is generated without human intervention, it can dramatically upset the economy of the game. For this reason, use of macros is a violation of the TOS or EULA of most MMORPGs, and administrators of MMORPGs fight a continual war to identify and punish macro users.[3] Application macros and scripting[edit] Keyboard and mouse macros that are created using an application's built-in macro features are sometimes called application macros. They are created by carrying out the sequence once and letting the application record the actions. An underlying macro programming language, most commonly a scripting language, with direct access to the features of the application may also exist. The programmers' text editor, Emacs, (short for "editing macros") follows this idea to a conclusion. In effect, most of the editor is made of macros. Emacs was originally devised as a set of macros in the editing language TECO; it was later ported to dialects of Lisp. Another programmers' text editor, Vim (a descendant of vi), also has full implementation of macros. It can record into a register (macro) what a person types on the keyboard and it can be replayed or edited just like VBA macros for Microsoft Office. Vim also has a scripting language called Vimscript[4] to create macros. Visual Basic for Applications (VBA) is a programming language included in Microsoft Office up to Office 2013. However, its function has evolved from and replaced the macro languages that were originally included in some of these applications. Macro virus[edit] Main article: Macro virus (computing) VBA has access to most Microsoft Windows system calls and executes when documents are opened. This makes it relatively easy to write computer viruses in VBA, commonly known as macro viruses. In the mid-to-late 1990s, this became one of the most common types of computer virus. However, during the late 1990s and to date, Microsoft has been patching and updating their programs. In addition, current anti-virus programs immediately counteract such attacks.

Text-substitution macros[edit] See also: Assembly language § Macros, and Algorithm Languages such as C and assembly language have rudimentary macro systems, implemented as preprocessors to the compiler or assembler. C preprocessor macros work by simple textual search-and-replace at the token, rather than the character level. A classic use of macros is in the computer typesetting system TeX and its derivatives, where most of the functionality is based on macros. MacroML is an experimental system that seeks to reconcile static typing and macro systems. Nemerle has typed syntax macros, and one productive way to think of these syntax macros is as a multi-stage computation. Other examples: m4 is a sophisticated stand-alone macro processor. TRAC Macro Extension TAL, accompanying Template Attribute Language SMX: for web pages ML/1 (Macro Language One) The General Purpose Macroprocessor is a contextual pattern matching macro processor, which could be described as a combination of regular expressions, EBNF and AWK SAM76 troff and nroff: for typesetting and formatting Unix manpages. Embeddable languages[edit] Some languages, such as PHP, can be embedded in free-format text, or the source code of other languages. The mechanism by which the code fragments are recognised (for instance, being bracketed by <?php and ?>) is similar to a textual macro language, but they are much more powerful, fully featured languages.

Procedural macros[edit] This section does not cite any sources. Please help improve this section by adding citations to reliable sources. Unsourced material may be challenged and removed. (June 2014) (Learn how and when to remove this template message) Macros in the PL/I language are written in a subset of PL/I itself: the compiler executes "preprocessor statements" at compilation time, and the output of this execution forms part of the code that is compiled. The ability to use a familiar procedural language as the macro language gives power much greater than that of text substitution macros, at the expense of a larger and slower compiler. Frame technology's frame macros have their own command syntax but can also contain text in any language. Each frame is both a generic component in a hierarchy of nested subassemblies, and a procedure for integrating itself with its subassembly frames (a recursive process that resolves integration conflicts in favor of higher level subassemblies). The outputs are custom documents, typically compilable source modules. Frame technology can avoid the proliferation of similar but subtly different components, an issue that has plagued software development since the invention of macros and subroutines. Most assembly languages have less powerful procedural macro facilities, for example allowing a block of code to be repeated N times for loop unrolling; but these have a completely different syntax from the actual assembly language.

Syntactic macros[edit] Macro systems—such as the C preprocessor described earlier—that work at the level of lexical tokens cannot preserve the lexical structure reliably. Syntactic macro systems work instead at the level of abstract syntax trees, and preserve the lexical structure of the original program. The most widely used implementations of syntactic macro systems are found in Lisp-like languages such as Common Lisp, Clojure, Scheme, ISLISP and Racket. These languages are especially suited for this style of macro due to their uniform, parenthesized syntax (known as S-expressions). In particular, uniform syntax makes it easier to determine the invocations of macros. Lisp macros transform the program structure itself, with the full language available to express such transformations. While syntactic macros are often found in Lisp-like languages, they are also available in other languages such as Prolog, Dylan, Scala, Nemerle, Rust, Elixir, Haxe,[5] and Julia. They are also available as third-party extensions to JavaScript,[6] C# and Python.[7].[8] Early Lisp macros[edit] Before Lisp had macros, it had so-called FEXPRs, function-like operators whose inputs were not the values computed by the arguments but rather the syntactic forms of the arguments, and whose output were values to be used in the computation. In other words, FEXPRs were implemented at the same level as EVAL, and provided a window into the meta-evaluation layer. This was generally found to be a difficult model to reason about effectively.[9] In 1963, Timothy Hart proposed adding macros to Lisp 1.5 in AI Memo 57: MACRO Definitions for LISP.[10] Anaphoric macros[edit] Main article: Anaphoric macro This section needs expansion. You can help by adding to it. (February 2018) Hygienic macros[edit] Main article: Hygienic macro In the mid-eighties, a number of papers[11][12] introduced the notion of hygienic macro expansion (syntax-rules), a pattern-based system where the syntactic environments of the macro definition and the macro use are distinct, allowing macro definers and users not to worry about inadvertent variable capture (cf. referential transparency). Hygienic macros have been standardized for Scheme in both the R5RS and R6RS standards. The upcoming R7RS standard will also include hygienic macros. A number of competing implementations of hygienic macros exist such as syntax-rules, syntax-case, explicit renaming, and syntactic closures. Both syntax-rules and syntax-case have been standardized in the Scheme standards. Recently, Racket has combined the notions of hygienic macros with a "tower of evaluators", so that the syntactic expansion time of one macro system is the ordinary runtime of another block of code,[13] and showed how to apply interleaved expansion and parsing in a non-parenthesized language.[14] A number of languages other than Scheme either implement hygienic macros or implement partially hygienic systems. Examples include Scala, and Julia, Dylan, and Nemerle. Applications[edit] Evaluation order Macro systems have a range of uses. Being able to choose the order of evaluation (see lazy evaluation and non-strict functions) enables the creation of new syntactic constructs (e.g. control structures) indistinguishable from those built into the language. For instance, in a Lisp dialect that has cond but lacks if, it is possible to define the latter in terms of the former using macros. For example, Scheme has both continuations and hygienic macros, which enables a programmer to design their own control abstractions, such as looping and early exit constructs, without the need to build them into the language. Data sub-languages and domain-specific languages Next, macros make it possible to define data languages that are immediately compiled into code, which means that constructs such as state machines can be implemented in a way that is both natural and efficient.[15] Binding constructs Macros can also be used to introduce new binding constructs. The most well-known example is the transformation of let into the application of a function to a set of arguments. Felleisen conjectures[16] that these three categories make up the primary legitimate uses of macros in such a system. Others have proposed alternative uses of macros, such as anaphoric macros in macro systems that are unhygienic or allow selective unhygienic transformation. The interaction of macros and other language features has been a productive area of research. For example, components and modules are useful for large-scale programming, but the interaction of macros and these other constructs must be defined for their use together. Module and component-systems that can interact with macros have been proposed for Scheme and other languages with macros. For example, the Racket language extends the notion of a macro system to a syntactic tower, where macros can be written in languages including macros, using hygiene to ensure that syntactic layers are distinct and allowing modules to export macros to other modules.

Macros for machine-independent software[edit] Macros are normally used to map a short string (macro invocation) to a longer sequence of instructions. Another, less common, use of macros is to do the reverse: to map a sequence of instructions to a macro string. This was the approach taken by the STAGE2 Mobile Programming System, which used a rudimentary macro compiler (called SIMCMP) to map the specific instruction set of a given computer to counterpart machine-independent macros. Applications (notably compilers) written in these machine-independent macros can then be run without change on any computer equipped with the rudimentary macro compiler. The first application run in such a context is a more sophisticated and powerful macro compiler, written in the machine-independent macro language. This macro compiler is applied to itself, in a bootstrap fashion, to produce a compiled and much more efficient version of itself. The advantage of this approach is that complex applications can be ported from one computer to a very different computer with very little effort (for each target machine architecture, just the writing of the rudimentary macro compiler).[17][18] The advent of modern programming languages, notably C, for which compilers are available on virtually all computers, has rendered such an approach superfluous. This was, however, one of the first instances (if not the first) of compiler bootstrapping.

See also[edit] Anaphoric macros Assembly language § Macros (the origin of the concept of macros) Extensible programming Hygienic macros Macro instruction Programming by demonstration String interpolation

References[edit] ^ Greenwald, Irwin D.; Maureen Kane (April 1959). "The Share 709 System: Programming and Modification" (PDF). Journal of the ACM. New York, NY, USA: ACM. 6 (2): 128–133. doi:10.1145/320964.320967. One of the important uses of programmer macros is to save time and clerical-type errors in writing sequence of instructions which are often repeated in the course of a program.  ^ Strachey, Christopher (October 1965). "A General Purpose Macrogenerator". Computer Journal. 8 (3): 225–241. doi:10.1093/comjnl/8.3.225.  ^ "Runescape: The Massive Online Adventure Game by Jagex Ltd". Retrieved 2008-04-03.  ^ ^ ^ ^ ^ ^ Marshall, Joe. "untitled email". Retrieved May 3, 2012.  ^ "AIM-057, MACRO Definitions for LISP, Timothy P. Hart".  ^ Kohlbecker, Eugene; Friedman, Daniel; Felleisen, Matthias; Duba, Bruce. "Hygienic Macro Expansion". doi:10.1145/319838.319859.  ^ [1] Clinger, Rees. "Macros that Work" ^ Flatt, Matthew. "Composable and compilable macros: you want it when?" (PDF).  ^ Rafkind, Jon; Flatt, Matthew. "Honu: Syntactic Extension for Algebraic Notation through Enforestation" (PDF).  ^ Brown University Paper on Automata Macros ^ [2], Matthias Felleisen, LL1 mailing list posting ^ Orgass, Richard J.; William M. Waite (September 1969). "A base for a mobile programming system". Communications of the ACM. New York, NY, USA: ACM. 12 (9): 507–510. doi:10.1145/363219.363226.  ^ Waite, William M. (July 1970). "The mobile programming system: STAGE2". Communications of the ACM. New York, NY, USA: ACM. 13 (7): 415–421. doi:10.1145/362686.362691.  v t e Types of programming languages Actor-based Array Aspect-oriented Class-based Concatenative Concurrent Data-structured Dataflow Declarative Domain-specific Dynamic Esoteric Event-driven Extensible Functional Imperative Logic Macro Metaprogramming Multi-paradigm Object-based Object-oriented Pipeline Procedural Prototype-based Reflective Rule-based Scripting Synchronous Templating Assembly Compiled Interpreted Machine Low-level High-level Very high-level First generation Second generation Third generation Fourth generation Fifth generation Non-English-based Visual Authority control GND: 4125810-1 Retrieved from "" Categories: Programming constructsSource codeAutomation softwareHidden categories: Articles to be merged from January 2017All articles to be mergedArticles to be merged from July 2017Articles containing Ancient Greek-language textArticles needing additional references from June 2014All articles needing additional referencesArticles to be expanded from February 2018All articles to be expandedArticles using small message boxesWikipedia articles with GND identifiers

Navigation menu Personal tools Not logged inTalkContributionsCreate accountLog in Namespaces ArticleTalk Variants Views ReadEditView history More Search Navigation Main pageContentsFeatured contentCurrent eventsRandom articleDonate to WikipediaWikipedia store Interaction HelpAbout WikipediaCommunity portalRecent changesContact page Tools What links hereRelated changesUpload fileSpecial pagesPermanent linkPage informationWikidata itemCite this page Print/export Create a bookDownload as PDFPrintable version Languages العربيةCatalàČeštinaDeutschEestiEspañolفارسیFrançais한국어हिन्दीÍslenskaItalianoעבריתҚазақшаКыргызчаMagyarNederlands日本語NorskОлык марийPolskiPortuguêsRomânăРусскийSuomiSvenskaTürkçeУкраїнська中文 Edit links This page was last edited on 16 February 2018, at 20:11. Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization. Privacy policy About Wikipedia Disclaimers Contact Wikipedia Developers Cookie statement Mobile view (window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgPageParseReport":{"limitreport":{"cputime":"0.408","walltime":"0.510","ppvisitednodes":{"value":1300,"limit":1000000},"ppgeneratednodes":{"value":0,"limit":1500000},"postexpandincludesize":{"value":57726,"limit":2097152},"templateargumentsize":{"value":650,"limit":2097152},"expansiondepth":{"value":12,"limit":40},"expensivefunctioncount":{"value":5,"limit":500},"entityaccesscount":{"value":1,"limit":400},"timingprofile":["100.00% 449.902 1 -total"," 34.27% 154.189 1 Template:Lang"," 20.83% 93.701 1 Template:Reflist"," 14.40% 64.806 1 Template:Merge"," 10.98% 49.391 4 Template:Cite_journal"," 10.56% 47.501 2 Template:Mbox"," 8.08% 36.348 1 Template:Redirect"," 5.31% 23.910 1 Template:Authority_control"," 3.44% 15.474 2 Template:Pagelist"," 3.24% 14.574 1 Template:Programming_paradigms"]},"scribunto":{"limitreport-timeusage":{"value":"0.260","limit":"10.000"},"limitreport-memusage":{"value":12362988,"limit":52428800}},"cachereport":{"origin":"mw1263","timestamp":"20180225071308","ttl":1900800,"transientcontent":false}}});});(window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgBackendResponseTime":78,"wgHostname":"mw1258"});});

Macro_(computer_science) - Photos and All Basic Informations

Macro_(computer_science) More Links

ISO 639 MacrolanguageWikipedia:MergingMacro InstructionTalk:Macro (computer Science)Parameterized MacroWikipedia:MergingTalk:Macro (computer Science)Programming ParadigmAction LanguageAgent-oriented ProgrammingArray ProgrammingAutomata-based ProgrammingConcept ProgrammingConcurrent ComputingRelativistic ProgrammingData-driven ProgrammingDeclarative ProgrammingImperative ProgrammingConstraint ProgrammingConstraint Logic ProgrammingConcurrent Constraint Logic ProgrammingDataflow ProgrammingFlow-based ProgrammingSpreadsheetReactive ProgrammingFunctional ProgrammingFunctional Logic ProgrammingPurely Functional ProgrammingLogic ProgrammingAbductive Logic ProgrammingAnswer Set ProgrammingConcurrent Logic ProgrammingFunctional Logic ProgrammingInductive Logic ProgrammingDynamic Programming LanguageEnd-user DevelopmentEvent-driven ProgrammingService-oriented ArchitectureTime-driven ProgrammingExpression-oriented Programming LanguageFeature-oriented ProgrammingFunction-level ProgrammingValue-level ProgrammingGeneric ProgrammingImperative ProgrammingDeclarative ProgrammingLiterate ProgrammingProcedural ProgrammingLanguage-oriented ProgrammingNatural-language ProgrammingService-oriented ModelingDomain-specific LanguageGrammar-oriented ProgrammingDialect (computing)Intentional ProgrammingMetaprogrammingAutomatic ProgrammingInductive ProgrammingReflection (computer Programming)Attribute-oriented ProgrammingHomoiconicityTemplate MetaprogrammingPolicy-based DesignNon-structured ProgrammingStructured ProgrammingArray ProgrammingNondeterministic ProgrammingParallel ComputingProcess-oriented ProgrammingTacit ProgrammingConcatenative Programming LanguageProbabilistic Programming LanguageSemantic-oriented ProgrammingStructured ProgrammingNon-structured ProgrammingBlock (programming)Modular ProgrammingMonolithic ApplicationObject-oriented ProgrammingActor ModelClass-based ProgrammingConcurrent Object-oriented ProgrammingPrototype-based ProgrammingSeparation Of ConcernsAspect-oriented ProgrammingRole-oriented ProgrammingSubject-oriented ProgrammingRecursion (computer Science)Value-level ProgrammingFunction-level ProgrammingQuantum ProgrammingTemplate:Programming ParadigmsTemplate Talk:Programming ParadigmsEnlargeJEditGreek LanguageComputer SciencePatternCharacter (computing)Software ApplicationProgramming LanguageCode ReuseDomain-specific LanguagesComputer ProgrammingConditional Assembly LanguageComputer ProgramOperating SystemComputing PlatformMacro InstructionAssembly LanguageAutomateMacro RecorderSmartKeyScreenplayTerminate And Stay Resident ProgramWord ProcessorSpreadsheetMassively Multiplayer Online Role-playing GameTerms Of ServiceEULAScripting LanguageEmacsText Editor And CorrectorLisp (programming Language)Vim (text Editor)ViVisual Basic For ApplicationsVimscriptVisual Basic For ApplicationsMicrosoft OfficeMacro Virus (computing)Visual Basic For ApplicationsWin32 APIComputer VirusMacro Virus (computing)MicrosoftAssembly LanguageAlgorithmC (programming Language)Assembly LanguagePreprocessorC PreprocessorTeXMacroMLStatic TypingNemerleMetaprogrammingM4 (computer Language)TRAC Programming LanguageMETALTemplate Attribute LanguageSMX (computer Language)ML/IGeneral Purpose MacroprocessorRegular ExpressionEBNFAWK (programming Language)SAM76TroffNroffPHPWikipedia:Citing SourcesWikipedia:VerifiabilityHelp:Introduction To Referencing With Wiki Markup/1Wikipedia:VerifiabilityHelp:Maintenance Template RemovalPL/IPreprocessorProcedural LanguageFrame Technology (software Engineering)Loop UnwindingAbstract Syntax TreeLisp (programming Language)Common LispClojureScheme (programming Language)ISLISPRacket (programming Language)S-expressionPrologDylan (programming Language)Scala (programming Language)NemerleRust (programming Language)Elixir (programming Language)HaxeJulia (programming Language)JavaScriptC Sharp (programming Language)Python (programming Language)FexprAnaphoric MacroEdit Section: Hygienic MacrosHygienic MacroHygienic MacroReferential Transparency (computer Science)R5RSR6RSR7RSRacket (programming Language)Reflection (computer Science)Scala (programming Language)Julia (programming Language)Dylan (programming Language)NemerleLazy EvaluationStrict FunctionControl StructuresContinuationMatthias FelleisenAnaphoric MacroSoftware ComponentModular ProgrammingRacket (programming Language)Bootstrapping (computing)C (programming Language)Bootstrapping (compilers)Anaphoric MacroAssembly LanguageExtensible ProgrammingHygienic MacroMacro InstructionProgramming By DemonstrationString InterpolationPDFDigital Object IdentifierChristopher StracheyDigital Object IdentifierDigital Object IdentifierDigital Object IdentifierDigital Object IdentifierTemplate:Types Of Programming LanguagesTemplate Talk:Types Of Programming LanguagesProgramming ParadigmActor ModelArray ProgrammingAspect-oriented ProgrammingClass-based ProgrammingConcatenative Programming LanguageConcurrent ComputingData-structured LanguageDataflow ProgrammingDeclarative ProgrammingDomain-specific LanguageDynamic Programming LanguageEsoteric Programming LanguageEvent-driven ProgrammingExtensible ProgrammingFunctional ProgrammingImperative ProgrammingLogic ProgrammingMetaprogrammingMulti-paradigm Programming LanguageObject-based LanguageObject-oriented ProgrammingPipeline ProgrammingProcedural ProgrammingPrototype-based ProgrammingReflection (computer Programming)Rule-based SystemScripting LanguageSynchronous Programming LanguageTemplating LanguageAssembly LanguageCompiled LanguageInterpreted LanguageMachine CodeLow-level Programming LanguageHigh-level Programming LanguageVery High-level Programming LanguageFirst-generation Programming LanguageSecond-generation Programming LanguageThird-generation Programming LanguageFourth-generation Programming LanguageFifth-generation Programming LanguageNon-English-based Programming LanguagesVisual Programming LanguageHelp:Authority ControlIntegrated Authority FileHelp:CategoryCategory:Programming ConstructsCategory:Source CodeCategory:Automation SoftwareCategory:Articles To Be Merged From January 2017Category:All Articles To Be MergedCategory:Articles To Be Merged From July 2017Category:Articles Containing Ancient Greek-language TextCategory:Articles Needing Additional References From June 2014Category:All Articles Needing Additional ReferencesCategory:Articles To Be Expanded From February 2018Category:All Articles To Be ExpandedCategory:Articles Using Small Message BoxesCategory:Wikipedia Articles With GND IdentifiersDiscussion About Edits From This IP Address [n]A List Of Edits Made From This IP Address [y]View The Content Page [c]Discussion About The Content Page [t]Edit This Page [e]Visit The Main Page [z]Guides To Browsing WikipediaFeatured Content – The Best Of WikipediaFind Background Information On Current EventsLoad A Random Article [x]Guidance On How To Use And Edit WikipediaFind Out About WikipediaAbout The Project, What You Can Do, Where To Find ThingsA List Of Recent Changes In The Wiki [r]List Of All English Wikipedia Pages Containing Links To This Page [j]Recent Changes In Pages Linked From This Page [k]Upload Files [u]A List Of All Special Pages [q]Wikipedia:AboutWikipedia:General Disclaimer

view link view link view link view link view link