LITTLE LANGUAGES LITTLE LANGUAGES BY Jon Bentley BY Jon Bentley PRESENTED BY: Alejandra Yepez PRESENTED BY: Alejandra Yepez Mississippi State University
LITTLELANGUAGESLITTLELANGUAGESBYJonBentleyBYJonBentley
PRESENTEDBY:AlejandraYepezPRESENTEDBY:AlejandraYepez
MississippiStateUniversity
LANGUAGESLANGUAGESIt is a particular kind of system for encoding and It is a particular kind of system for encoding and decoding information.decoding information.
Combination of symbols in order to produce any Combination of symbols in order to produce any meaning that can be understood by a group meaning that can be understood by a group domain.domain.
Examples?Examples?
MississippiStateUniversity
LANGUAGESLANGUAGESExamples:Examples:
Human LanguagesHuman Languages
MississippiStateUniversity
LANGUAGESLANGUAGESExamples:Examples:
Artificial LanguagesArtificial Languages
MississippiStateUniversity
LANGUAGESLANGUAGESExamples:Examples:
Artificial LanguagesArtificial Languages
MississippiStateUniversity
LANGUAGESLANGUAGESExamples:Examples:
Artificial Languages: Artificial Languages: AdunaicAdunaic
MississippiStateUniversity
LANGUAGESLANGUAGESExamples:Examples:
Artificial LanguagesArtificial Languages
MississippiStateUniversity
ProgrammingProgramming LanguagesLanguagesProgramming languages can be used to create Programming languages can be used to create programs that control the behavior of a programs that control the behavior of a machine, to express algorithms precisely, or as machine, to express algorithms precisely, or as a mode of human communicationa mode of human communication..
MississippiStateUniversity
EvolutionoftheMajorProgrammingLanguagesEvolutionoftheMajorProgrammingLanguagesMississippiStateUniversity
RootofsomeHumanRootofsomeHuman LanguagesLanguagesNatural,preNatural,preexistinglanguagesmayalsobeusedinexistinglanguagesmayalsobeusedin
thisway;theirdevelopersmerelycataloguedandthisway;theirdevelopersmerelycataloguedand standardizedtheirvocabularyandidentifiedtheirstandardizedtheirvocabularyandidentifiedtheir grammaticalrules.grammaticalrules.
Onesuchlanguage,Onesuchlanguage,LatinoSineLatinoSineFlexioneFlexione,,
wasthewasthe basedforthedevelopmentofnewhumanlanguagesbasedforthedevelopmentofnewhumanlanguages
likeSpanish,Portuguese,French,Italian,andothers.likeSpanish,Portuguese,French,Italian,andothers.
MississippiStateUniversity
LITTLELANGUAGESLITTLELANGUAGESAny
Mechanism
to
express
intent,
and
the
input
to
many
programsAny
Mechanism
to
express
intent,
and
the
input
to
many
programs
canbeviewedasstatementinalanguagecanbeviewedasstatementinalanguage..
Littlelanguages=computerlanguages(JonBentley,1986).Littlelanguages=computerlanguages(JonBentley,1986).
Little
languages
commonly
known
as
domainLittle
languages
commonly
known
as
domainspecific
languagesspecific
languages
((DSLsDSLs),ormicro),ormicrolanguages.languages.
DomainDomainSpecific
Language
(DSL):Specific
Language
(DSL):
A
small,
usually
declarative,A
small,
usually
declarative,
languageexpressiveoverthedistinguishingcharacteristicsofalanguageexpressiveoverthedistinguishingcharacteristicsofa
setofsetof
programsinaparticularproblemdomainprogramsinaparticularproblemdomain
(Walton,1996).(Walton,1996).
In
contrast
to
a
general
purpose
language
(GPL),
a
domainIn
contrast
to
a
general
purpose
language
(GPL),
a
domainspecificspecific
language
(DSL)
is
a
language
that
is
expressive
uniquely
over
thlanguage
(DSL)
is
a
language
that
is
expressive
uniquely
over
thee
specificfeaturesofprogramsinagivenproblemdomain.specificfeaturesofprogramsinagivenproblemdomain.
MississippiStateUniversity
LITTLELANGUAGESLITTLELANGUAGESLittle
languages
commonly
known
as
domainLittle
languages
commonly
known
as
domainspecific
languagesspecific
languages
((DSLsDSLs),ormicro),ormicrolanguages.languages.
In
contrast
to
a
general
purpose
language
(GPL),
a
domainIn
contrast
to
a
general
purpose
language
(GPL),
a
domainspecificspecific
language
(DSL)
is
a
language
that
is
expressive
uniquely
over
thlanguage
(DSL)
is
a
language
that
is
expressive
uniquely
over
thee
specificfeaturesofprogramsinagivenproblemdomain.specificfeaturesofprogramsinagivenproblemdomain.
MississippiStateUniversity
Someone asked: "What do little programming languages have to do with domain analysis/reuse?
Someone asked: "Currently, therere many systems that we can learn to use and master it within a short period of time but Im sure that theyre not small languages so is there any other outstanding characteristic of little language?
LITTLELANGUAGESLITTLELANGUAGESSomewidelyusedSomewidelyusedDSLsDSLs
withtheirapplicationdomains:withtheirapplicationdomains:
Someone asked: "Is the Microsoft Visual Studio a little language, since it has ways for users to point and click to put together a Windows application? Someone asked: "Are little languages common in today's market?Someone asked: "Are the principles introduced in this paper still valid these days?
Someone asked: "This is a 1986 paper when computer technology was used by pretty advanced users and scientists. However, in current globalized market, how feasible it is to develop little languages from business point of view?Someone asked: "Although the advantages of the little languages, I really double about their abilities to handling complex problems nowadays, considering such idea was proposed nearly twenty years ago and problems become much complex.
PICPICCreatedbyBrianKernighan.CreatedbyBrianKernighan.
HeisthecreatoroftheexpressionWYSIAYG,andHeisthecreatoroftheexpressionWYSIAYG,and WYSIWYG.WYSIWYG.
MississippiStateUniversity
PICPIC
WYSIAYG:WYSIAYG:"WhatYouSeeIsAll"WhatYouSeeIsAll YouGet"YouGet"
WYSIWYG:WYSIWYG:"WhatYouSeeIs"WhatYouSeeIs WhatYouGetWhatYouGet
MississippiStateUniversity
PICPIC Howdoweuseit?Howdoweuseit?PicPic
isadomainisadomainspecificlanguagefordrawingpictures.specificlanguagefordrawingpictures.
PicPic
providesboxes,lines,arrows,circles,ellipses,arcs,providesboxes,lines,arrows,circles,ellipses,arcs, andandsplinessplines,plusfacilitiesforpositioningandlabeling,plusfacilitiesforpositioningandlabeling
them.them.
MississippiStateUniversity
PICPIC Howdoweuseit?Howdoweuseit?Each
picture
begins
withEach
picture
begins
with
..PS
and
ends
withand
ends
with
.PE.PE;;
betweenthemarecommandstodescribethepicture.betweenthemarecommandstodescribethepicture.
Eachcommandistypedonalinebyitself.Eachcommandistypedonalinebyitself.
PicPic
is
ais
a
trofftroff
preprocessor;
it
passes
most
of
its
inputpreprocessor;
it
passes
most
of
its
input through
untouched,
but
translates
commands
betweenthrough
untouched,
but
translates
commands
between
.PS
and
.PE
into.PS
and
.PE
into
trofftroff
commands
that
draw
thecommands
that
draw
the pictures.pictures.
MississippiStateUniversity
PICPIC Basic!!Basic!!Forexample:Forexample:
.PS.PS
box"thisis""aboxbox"thisis""abox
.PE.PE
ResultResult
MississippiStateUniversity
PICPIC Basic!!Basic!!
Textiscenteredonlinesandarrows;ifthereismorethanoneTextiscenteredonlinesandarrows;ifthereismorethanone lineoftext,thelinesarecenteredaboveandbelow:lineoftext,thelinesarecenteredaboveandbelow:
line"thisis""alineline"thisis""aline
arrow"thisis""anarrowarrow"thisis""anarrow
Boxesandlinesmaybedashedordotted;justaddthewordBoxesandlinesmaybedashedordotted;justaddtheword dashedordottedafterboxorline:dashedordottedafterboxorline:
linedashed"dashed""linelinedashed"dashed""line
MississippiStateUniversity
Wecanusecircleorellipseinplaceofabox:Wecanusecircleorellipseinplaceofabox:
PICPIC Basic!!Basic!!MississippiStateUniversity
Arcsbydefaultturn90degreescounterclockwisefromtheArcsbydefaultturn90degreescounterclockwisefromthe currentdirection;youcanmakethemturnclockcurrentdirection;youcanmakethemturnclockwisebysayingwisebysaying
arcarccwcw::
lineline;arc;arc;arc;arccwcw;;arrowarrow
Whatistheshapeofarc;arc;arc;arc?
PICPIC Basic!!Basic!!MississippiStateUniversity
Whatistheshapeofarc;arc;arc;arc???
PICPIC Basic!!Basic!!MississippiStateUniversity
Objectsarenormallydrawnoneafteranother,lefttoright,andObjectsarenormallydrawnoneafteranother,lefttoright,and connectedattheobviousplaces:connectedattheobviousplaces:
arrow;arrow;
box"inputbox"input;;
arrow;arrow;
box"process";box"process";
arrow;arrow;
box"output";box"output";
Arrow;Arrow;
PICPICControllingSizes!!ControllingSizes!!MississippiStateUniversity
EachobjectthatPICknowsabout(boxes,circles,etc.)hasEachobjectthatPICknowsabout(boxes,circles,etc.)has associateddimensions,likeheight(ht),width(associateddimensions,likeheight(ht),width(widwid),radius),radius ((radrad),andsoon.),andsoon.
Forexample:Forexample:
boxwidth3height0.1;
circleradius0.1;
Box
34"wide 12"highCircle
12 diameterEllipse
34 wide 12"highArc
12 radiuslineorarrow12 longmove
12 inthecurrentdirection
PICPICControllingPositions!!ControllingPositions!!MississippiStateUniversity
Youcanplacethingsanywhereyouwant.Youcanplacethingsanywhereyouwant.
PicPic
usesastandardCartesiancoordinatesystemwithxusesastandardCartesiancoordinatesystemwithx increasingrightwardsandyincreasingupwards,soanypointincreasingrightwardsandyincreasingupwards,soanypoint
orobjecthasanxandyposition,measuredininches.orobjecthasanxandyposition,measuredininches.
PICPICControllingSizes!!ControllingSizes!!MississippiStateUniversity
EachLinesandarrowsaremosteasilydrawnbyspecifyingtheEachLinesandarrowsaremosteasilydrawnbyspecifyingthe amountofmotionfromwhereyouarerightnow,intermsofamountofmotionfromwhereyouarerightnow,intermsof
directions.directions.
Accordinglythewordsup,down,leftandrightandanoptionalAccordinglythewordsup,down,leftandrightandanoptional distancecanbeattachedtoline,arrow,andmove.distancecanbeattachedtoline,arrow,andmove.
Forexample:Forexample:
PICPIC
Labels!Labels!
MississippiStateUniversity
ObjectscanbeObjectscanbelabelledlabelled
ornamedsothatyoucantalkaboutornamedsothatyoucantalkabout themlater.themlater.
Forexample,Forexample,
Box1:Box1:
boxbox
LetLetsdoanexercise!sdoanexercise!TheGOALisTheGOALiscreateapictureusingagivencreateapictureusingagivenPICPICss
inputinput..
MississippiStateUniversity
Rules!Rules!Youhavesomesymbolsinthismoment!Youhavesomesymbolsinthismoment!
LetLetscreateapictureonthewallwiththesymbolsyouhave.screateapictureonthewallwiththesymbolsyouhave. ONEATATIME!ONEATATIME!
YouhavearoundYouhavearound30seconds30seconds
toputasymbolinitsrespectivetoputasymbolinitsrespective positiononthefigure.After30secondsifyouhavethepositiononthefigure.After30secondsifyouhavethe
followingsymbolandyoudidnotputit,youfollowingsymbolandyoudidnotputit,youreout!reout!
IfyoumakeamistakeyouIfyoumakeamistakeyoureout!reout!
ThepersonwhowinswillreceiveaThepersonwhowinswillreceiveagiftgift!:)!:)
LetLetsdoanexercise!sdoanexercise!LetLetss
createacreatea picturepicture
usingtheusingthe followingfollowing input:input:
MississippiStateUniversity
.PSarrow"source""code"
LA:
box"lexical""analyzer"arrow"tokens"above
P:
box"parser"arrow"intermediate""code"
Sem:
box"semantic""checker"arrow
arrowupfromtopofLALC:
box"lexical""corrector"arrowupfromtopofP
Syn:
box"syntactic""corrector"arrowup
DMP:
box"diagnostic""message""printer"arrowrightfromrightofDMP
ST:
box"symbol""table"arrowfromLC.ne
toDMP.swarrowfromSem.nw
toDMP.searrowfromSem.top
toST.bot.PE
LetLetsdoanexercise!sdoanexercise!MississippiStateUniversity
PICPICss CompilerVsCompilerVs CompilerCompiler
MississippiStateUniversity
PICPICss CompilerVsCompilerVs CompilerCompiler
MississippiStateUniversity
PICPICss CompilerVsCompilerVs CompilerCompiler
MississippiStateUniversity
LEX
PICPICss
CompilerVsCompilerCompilerVsCompiler LexicalAnalysisLexicalAnalysis
MississippiStateUniversity
LEX
ThelexicalanalyzerbreakstheinputtextintounitscalledThelexicalanalyzerbreakstheinputtextintounitscalledtokenstokens..
WWhenapattern(onthelefthenapattern(onthelefthandside)isrecognized,theactiononhandside)isrecognized,theactionon
therightisperformed.therightisperformed.
Forexample,Forexample,
>> return(GTreturn(GT););
Forexample,thePICinputline:Forexample,thePICinputline:linedownfromB1.SlinedownfromB1.S
WillbereturnbytheWillbereturnbythelexerlexer
usingthefollowingsequence:usingthefollowingsequence:
LINELINE
DOWNDOWN
FROMFROM
SYMBOL:B1SYMBOL:B1
SOUTHSOUTH
PIC
input
line
PICPICss
CompilerVsCompilerCompilerVsCompiler LexicalAnalysisLexicalAnalysis
MississippiStateUniversity
LEX
Someone asked: "LEX uses a little language for regular expressions to specify lexical analyzers. What other programs on your system employ regular expressions? How do they differ and why?
MississippiStateUniversity
AC++sample:AC++sample:Sum=4;Sum=4;
WillbereturnbytheWillbereturnbythelexerlexer
usingthefollowingsequence:usingthefollowingsequence:
LEXEMELEXEME
TOKENTOKEN
TOKENTOKEN
##
VALUE/NAMEVALUE/NAME
SumSum
IDENTIDENT
3030
SumSum
==
ASSIGNASSIGN
55
44
INTEGERINTEGER
5858
44
;;
ENDSTATMENDSTATM
99
PICPICss
CompilerVsCompilerCompilerVsCompiler LexicalAnalysisLexicalAnalysis
PICPICss CompilerVsCompilerVs CompilerCompiler
MississippiStateUniversity
YACC
PICPICss
CompilerVsCompilerCompilerVsCompiler SyntaxAnalysisSyntaxAnalysis
MississippiStateUniversity
YACC=YACC=YetAnotherCompilerYetAnotherCompiler
Compiler.Compiler.
PParsergenerator.arsergenerator.
TheinputhasthesameformasLEX.TheinputhasthesameformasLEX.
Forexample,Forexample,
Primitive:Primitive:
BOXBOXattrlistattrlist {boxgen($1);}{boxgen($1);}AttrlistAttrlist::
attrlistattrattrlistattr;;
AttrAttr::
DIRDIRexprexpr
{storefattr($1,!DEF,$2);}{storefattr($1,!DEF,$2);}
PICPICss
CompilerVsCompilerCompilerVsCompiler SymbolTableSymbolTable
MississippiStateUniversity
PICPICss
CompilerVsCompilerCompilerVsCompiler
CodeGenerationCodeGeneration
MississippiStateUniversity
MAKE
PICPICss
CompilerVsCompilerCompilerVsCompiler MAKEMAKE
MississippiStateUniversity
MAKE:keepingupMAKE:keepinguptotodateversionsofthefilescontainingheaderdateversionsofthefilescontainingheader
code,sourcecode,objectcode,documentation,andtestcases.code,sourcecode,objectcode,documentation,andtestcases.
PICPICss AdvantagesAdvantagesMississippiStateUniversity
LEX
YACC
MAKE
PICPICss AdvantagesAdvantagesMississippiStateUniversity
LEX
YACC
MAKE
Someone asked: "How can processors of little languages respond to linguistic errors?
Someone asked: "How can a better understanding of linguistic Insight can give you a better understanding of the tools you now use and how can it help you in programming better?
PICPICss AdvantagesAdvantagesOne
of
the
greatest
advantages
of
little
languages
is
thatOne
of
the
greatest
advantages
of
little
languages
is
that
oneprocessoroneprocessorsinputisanotherprocessorsinputisanotherprocessorsoutput.soutput.
MississippiStateUniversity
Someone asked: "How exactly little languages like PIC support other processors output (the preprocessor concept that the paper is talking about)?
Someone asked: " All problems today can be solved using object oriented programming (at least Dr. Boggess said so). I could see the relevancy for one to make their own programming languages years ago, but why would they need to do that today?
PrinciplesandAdvantagePrinciplesandAdvantage ofLittleLanguagesofLittleLanguages
Little
languages
are
important
part
of
the
fourthLittle
languages
are
important
part
of
the
fourth
and
Fifthand
Fifth GenerationLanguagesandApplicationGenerators.GenerationLanguagesandApplicationGenerators.
Provide
an
elegant
interface
for
humans
to
control
complexProvide
an
elegant
interface
for
humans
to
control
complex programs.programs.
Itissimplertohaveaalargesystemcomposedofmodules.Itissimplertohaveaalargesystemcomposedofmodules.
It
is
better
before
designing
a
language,
carefully
study
theIt
is
better
before
designing
a
language,
carefully
study
the problemanddividinginparts.problemanddividinginparts.
A
smaller
language
is
easier
to
design,
build,
document,
andA
smaller
language
is
easier
to
design,
build,
document,
and maintain.maintain.
Littlelanguagesarecreative.Littlelanguagesarecreative.
MississippiStateUniversity
PrinciplesandAdvantagePrinciplesandAdvantage ofLittleLanguagesofLittleLanguages
Itissimplertohaveaalargesystemcomposedofmodules.Itissimplertohaveaalargesystemcomposedofmodules.
MississippiStateUniversity
Someone asked: "Are the reusable components considered the Little Languages we build as programmers?
PrinciplesandAdvantagePrinciplesandAdvantage ofLittleLanguagesofLittleLanguages
MississippiStateUniversity
WhyisLTorDSLsoimportantWhyisLTorDSLsoimportant withintheSoftwareReusearea?withintheSoftwareReusearea?
TheyofferappropriatedomainTheyofferappropriatedomainspecificnotationsfromthestart.specificnotationsfromthestart.
TheirprimarycontributionistoenablereuseofsoftwareartifaTheirprimarycontributionistoenablereuseofsoftwareartifacts.cts.
SoftwarearchitecturesarecommonlyreusedwhenSoftwarearchitecturesarecommonlyreusedwhenDSLsDSLs
areare employed;forexample,GAL(GraphicsAdaptorlanguage).employed;forexample,GAL(GraphicsAdaptorlanguage).
MississippiStateUniversity
Some people asked: How does "Little Languages" apply to software reuse?
Someone asked: Using/creating little languages is one way to reuse software assets (e.g. tools) to build the program but using big language also reuse some assets too so which one is better?
BibliographyBibliographySlides from Dr. Boggess class in Programming Languages.
J. Bentley, "Programming pearls: little languages", Communications of the ACM, 29(8): 711-721, August 1986, ACM Press.
M. Mernik, J. Heering, and A. M. Sloane, "When and how to develop domain-specific languages", ACM Computing Surveys, 37(4): 316-344, December 2005, ACM Press.
A. Van Deursen and P. Klint, Little Languages:LittleMaintenance?, Journal of Software Maintenance, 10(2), 1998.
B. W. Kernigham, PIC A Graphics Language for Typesetting User Manual, AT&T Bell Laboratories Murray Hill, New Jersey.
S. Thibault, R. Marlet, and C. Consel, A Domain Specific Language for Video Device Drivers: from Design to Implementation, Proceedings of the Conference on Domain-Specific Languages, Santa Barbara, California, Oct. 1997.
MississippiStateUniversity
BibliographyBibliographyhttp://en.wikipedia.org/wiki/Programming_language
http://en.wikipedia.org/wiki/Language
http://en.wikipedia.org/wiki/Artistic_language
http://en.wikipedia.org/wiki/J._R._R._Tolkien
http://en.wikipedia.org/wiki/Adnaic
http://www.answers.com/topic/programminglanguage
http://en.wikipedia.org/wiki/Brian_Kernighan
MississippiStateUniversity
MississippiStateUniversity
LITTLE LANGUAGESLANGUAGESLANGUAGESLANGUAGESLANGUAGESLANGUAGESLANGUAGESProgramming LanguagesEvolution of the Major Programming LanguagesRoot of some Human LanguagesLITTLE LANGUAGESLITTLE LANGUAGESLITTLE LANGUAGESPICPICPIC How do we use it?PIC How do we use it?PIC Basic!!PIC Basic!!PIC Basic!!PIC Basic!!PIC Basic!!PIC Controlling Sizes!!PIC Controlling Positions!!PIC Controlling Sizes!!PIC Labels!Lets do an exercise!Lets do an exercise!Lets do an exercise!PICs Compiler Vs CompilerPICs Compiler Vs CompilerPICs Compiler Vs CompilerPICs Compiler Vs CompilerLexical AnalysisPICs Compiler Vs CompilerLexical AnalysisPICs Compiler Vs CompilerLexical AnalysisPICs Compiler Vs CompilerPICs Compiler Vs CompilerSyntax AnalysisPICs Compiler Vs CompilerSymbol TablePICs Compiler Vs Compiler Code Generation PICs Compiler Vs Compiler MAKE PICs AdvantagesPICs AdvantagesPICs AdvantagesPrinciples and Advantage of Little LanguagesPrinciples and Advantage of Little LanguagesPrinciples and Advantage of Little LanguagesWhy is LT or DSL so important within the Software Reuse area?BibliographyBibliographySlide Number 50