Flex (어휘분석기)

flex
개발자Vern Paxson
안정화 버전
2.6.4 / 2017년 5월 6일(7년 전)(2017-05-06)
저장소
운영 체제유닉스 계열
종류어휘 분석기 발생기
라이선스BSD 라이선스
웹사이트flex.sourceforge.net

flex는 《fast lexical analyzer generator》의 줄임말로 lex의 기능을 개선한 자유 소프트웨어이다. 주로 bison과 쌍을 이루어 구문 분석기를 만드는 데 사용된다. flex를 이용하면 C로 구문 분석 코드를 만들 수 있다. 한편 C++ 코드를 만들어 주는 비슷한 기능을 하는 프로그램으로 flex++가 있으며 flex와 함께 배포된다. 작성자는 "Vern Paxson"씨로 1987년도에 처음 만들어졌다.

예제

아래는 PL/0 프로그래밍 언어를 위한 Flex 스캐너의 예이다.

인식되는 토큰은 다음과 같다: '+', '-', '*', '/', '=', '(', ')', ',', ';', '.', ':=', '<', '<=', '<>', '>', '>='; 숫자: 0-9 {0-9}; 식별자: a-zA-Z {a-zA-Z0-9} 및 키워드: begin, call, const, do, end, if, odd, procedure, then, var, while.

%{
#include "y.tab.h"
%}

digit [0-9]
letter [a-zA-Z]

%%
"+" { return PLUS; }
"-" { return MINUS; }
"*" { return TIMES; }
"/" { return SLASH; }
"(" { return LPAREN; }
")" { return RPAREN; }
";" { return SEMICOLON; }
"," { return COMMA; }
"." { return PERIOD; }
":=" { return BECOMES; }
"=" { return EQL; }
"<>" { return NEQ; }
"<" { return LSS; }
">" { return GTR; }
"<=" { return LEQ; }
">=" { return GEQ; }
"begin" { return BEGINSYM; }
"call" { return CALLSYM; }
"const" { return CONSTSYM; }
"do" { return DOSYM; }
"end" { return ENDSYM; }
"if" { return IFSYM; }
"odd" { return ODDSYM; }
"procedure" { return PROCSYM; }
"then" { return THENSYM; }
"var" { return VARSYM; }
"while" { return WHILESYM; }
{letter}({letter}|{digit})* {
                       yylval.id = strdup(yytext);
                       return IDENT;      }
{digit}+ { yylval.num = atoi(yytext);
                       return NUMBER;     }
[ \t\n\r] /* skip whitespace */
. { printf("Unknown character [%c]\n",yytext[0]);
                       return UNKNOWN;    }
%%

int yywrap(void){return 1;}

같이 보기

외부 링크

Read other articles:

العلاقات الليبيرية الهندوراسية ليبيريا هندوراس   ليبيريا   هندوراس تعديل مصدري - تعديل   العلاقات الليبيرية الهندوراسية هي العلاقات الثنائية التي تجمع بين ليبيريا وهندوراس.[1][2][3][4][5] مقارنة بين البلدين هذه مقارنة عامة ومرجعية للدولتين: وج...

 

Gynaephora Gynaephora selenitica, imago ♂SystematikDomänEukaryoterEukaryotaRikeDjurAnimaliaStamLeddjurArthropodaUnderstamSexfotingarHexapodaKlassEgentliga insekterInsectaOrdningFjärilarLepidopteraÖverfamiljNoctuoideaFamiljErebidaeUnderfamiljTofsspinnareLymantriidaeSläkteGynaephoraVetenskapligt namn§ GynaephoraAuktorHübner, 1819Hitta fler artiklar om djur med Djurportalen Gynaephora[1][2] är ett släkte av fjärilar som beskrevs av Jacob Hübner 1819. Gynaephora ingår i familjen Ereb...

 

Untuk kegunaan lain, lihat Elizabeth. ElisabetElisabet (kiri) dikunjungi Maria, oleh Philippe de ChampaigneBerbudi BaikLahirAbad 1 SMHebron (Joshua 21:11:niv)MeninggalAbad 1 SM (atau mendekati Masehi)(mungkin Hebron)Dihormati diGereja Katolik RomaGereja Ortodoks TimurGereja Ortodoks OrientalGereja AnglikanGereja LutheranIslamPesta5 November(Gereja Katolik Roma, Lutheran)5 September (Gereja Ortodoks Timur, Anglikan) Elisabet (Ibrani: אֱלִישֶׁבַע / אֱלִישָׁבַע Ĕlîšé

أولاد الياقوت تقسيم إداري البلد المغرب  الجهة فاس مكناس الإقليم تاونات الدائرة قرية با محمد الجماعة القروية سيدي العابد المشيخة الكرادسة السكان التعداد السكاني 87 نسمة (إحصاء 2004)   • عدد الأسر 11 معلومات أخرى التوقيت ت ع م±00:00 (توقيت قياسي)[1]،  وت ع م+01:00 (توقيت صيفي...

 

Роман Михайлович МатейкоНародився 14 лютого 1946(1946-02-14)с. Кінашів, Галицький район, Івано-Франківська область, УкраїнаПомер 19 травня 2007(2007-05-19) (61 рік)м. Тернопіль, УкраїнаПоховання Міське кладовище біля с. Підгороднього, Тернопіль :  Країна  УРСР →  УкраїнаНаціональ

 

تصنيف إدمان ألعاب الفيديو كاضطراب نفسي مازال محل جدل إدمان ألعاب الفيديو يشير إلى الاستخدام المفرط أو القهري لألعاب الكمبيوتر أو ألعاب الفيديو، والتي تتداخل مع الحياة اليومية للشخص.[1] إدمان ألعاب الفيديو يتجلى في أنه الإحساس بنوع من الإجبار على اللعب، العزلة الاجتما...

Footfalls of Indian History AuthorSister NiveditaPublisherGreen, and CoPublished in English1915 Footfalls of Indian History (1915) is a book written by Sister Nivedita.[1] Nivedita dedicated her life for the service of India.[2] In the book the author has discussed on several chapters of Indian history about its glory and drawbacks. The most important topics of Indian history like religions of India, Indian philosophy, Indian culture, and Indian architecture have been dis...

 

Single-engine, low-wing tandem-seat turboprop military training aircraft PC-9 Pilatus PC-9M of the Slovenian Armed Forces Role Basic/advanced trainer aircraftType of aircraft National origin Switzerland Manufacturer Pilatus Aircraft First flight 7 May 1984 Status Active service Primary users Swiss Air ForceSlovenian Air Force and Air Defence Royal Saudi Air Force Royal Thai Air Force Produced 1984–present Number built 265 Developed from Pilatus PC-7 Developed into T-6 Texan II The Pila...

 

Chinese hotel chain Not to be confused with Days Inn. 7 Days Group Holdings LimitedTypePrivateIndustryHotelFounded2005HeadquartersGuangzhou, Guangdong, ChinaNumber of locations4,600 (as December 2018)Websitewww.7daysinn.cn 7 Days Group Holdings LimitedTraditional Chinese7天連鎖酒店集團Simplified Chinese7天连锁酒店集团TranscriptionsStandard MandarinHanyu PinyinQītiān Liánsuǒ Jiǔdiàn JítuánYue: CantoneseJyutpingCat1tin1 Lin4so2 Zau2dim3 Zaap6tyun4 7 Days Group Holding...

Village in Jablanica District, SerbiaGrdanicaVillageGrdanicaCoordinates: 43°07′47″N 21°56′27″E / 43.12972°N 21.94083°E / 43.12972; 21.94083Country SerbiaDistrictJablanica DistrictMunicipalityLeskovacElevation958 ft (292 m)Population (2002) • Total605Time zoneUTC+1 (CET) • Summer (DST)UTC+2 (CEST) Grdanica is a village in the municipality of Leskovac, Serbia. According to the 2002 census, the village has a populati...

 

American football developmental league For the American football league that played in 2000, see Spring Football League. For the planned American football league, see Spring League of American Football. The Spring LeagueMost recent season or competition:2021 The Spring League seasonClassificationDevelopmental (Pro showcase)SportAmerican footballFounded2016Inaugural season2017Ceased2021CEOBrian WoodsNo. of teams8CountryUnited StatesLastchampion(s)LinemenTV partner(s)United States:Fox/FS1/FS2Re...

 

County in Kuyavian-Pomeranian Voivodeship, PolandMogilno County Powiat mogileńskiCounty FlagCoat of armsLocation within the voivodeshipCoordinates (Mogilno): 52°39′N 17°57′E / 52.650°N 17.950°E / 52.650; 17.950Country PolandVoivodeshipKuyavian-PomeranianSeatMogilnoGminas Total 4 Gmina DąbrowaGmina Jeziora WielkieGmina MogilnoGmina Strzelno Area • Total675.86 km2 (260.95 sq mi)Population (2006) • Total45,756...

Ruta Nacional 260  Argentina Datos de la rutaIdentificador  RN 260 Tipo Ruta nacionalLongitud 107 kmOtros datosProvincia  ChubutIntersecciones al norte del límite con Santa CruzOrientación • este RN 40 5 km al norte del límite con Santa Cruz (45°57′7.6″S 70°24′17.5″O / -45.952111, -70.404861) • oeste Paso internacional Huemules (45°54′56.3″S 71°38′39.4″O / -45.915639, -71.644278)Siguientes rutas ← → &...

 

1996 soundtrack album by various artistsThe Nutty ProfessorSoundtrack album by various artistsReleasedJune 4, 1996Recorded1995–1996GenreHip hopR&BLength55:13LabelDef JamProducerBrian Grazer (exec.)Harry Garfield (exec.)Lyor Cohen (exec.)Russell Simmons (exec.)Tina Davis (exec.)4th DiscipleBabyfaceBig JazCory RooneyDallas AustinDeVante SwingDJ DarylDR PeriodErick SermonJames Earl JonesKenny KornegayPrince Markie DeeRashad SmithRichie RichWarren GNutty Professor soundtracks ch...

 

Season of television series JustifiedSeason 3Season 3 DVD coverCountry of originUnited StatesNo. of episodes13ReleaseOriginal networkFXOriginal releaseJanuary 17 (2012-01-17) –April 10, 2012 (2012-04-10)Season chronology← PreviousSeason 2 Next →Season 4 List of episodes The third season of the American neo-Western[1] television series Justified premiered on January 17, 2012, on FX, and concluded on April 10, 2012, consisting of 13 episodes. The series wa...

International sporting eventVolleyball at the 1955 Pan American Games1959» This page presents the results of the men's and women's volleyball tournament during the 1955 Pan American Games, which was held from March 15 to March 24, 1955 in Mexico City, Mexico. Men's indoor tournament Preliminary round robin Date Score Set 1 Set 2 Set 3 Set 4 Set 5 Total Report Mar 16 Mexico  3–0  Uruguay 15–9 15–10 15–6     45–24   Mar 16 United States  3–0  Vene...

 

List of films of Waheed Murrad Waheed Murad in 1962 Waheed Murad (Urdu: وحید مراد; 2 October 1938 – 23 November 1983) was a Pakistani film actor, producer and script writer, famous for his charming expressions, attractive personality, tender voice and unusual talent for acting.[1] Waheed is considered as one of the most famous and influential actors of South Asia.[2] He is often referred to as Chocolaty Hero or Chocolate Hero. Born in Karachi, Sindh, Pakistan, did gr...

 

У этого термина существуют и другие значения, см. Бурбон. Бурбоныфр. Bourbon, исп. Borbón, итал. Borbone Герб Третьего дома Бурбонов: в лазуревом, усеянном золотыми лилиями щите, червлённая перевязь Страна Франция, Испания, Наварра, Сицилия, Неаполь, Парма и Пьяченца Родонача...

Sacred site in the Free State, South Africa Witsie’s caveLocationWitsieshoek, Free StateNearest cityQwaQwa and ClarensAreaWitsieshoekEstablishedDeclared a Provincial Heritage Site in 2016 Witsie’s cave (Lehaeng la Wetsi) is a sacred site in the Free State and is named after the grandson of Chief Seeka of Makholokoe. The cave is largely associated with Makholokoe – a tribe of the Basotho and has a rich history relating to this tribe, as well as the interactions between blacks and Bo...

 

American lawyer, politician & soldier Peter T. WashburnEngraving circa 1865 by Henry Bryan Hall and Sons (New York, NY)31st Governor of VermontIn officeOctober 15, 1869 – February 7, 1870LieutenantGeorge W. HendeePreceded byJohn B. PageSucceeded byGeorge W. HendeeMember of the Vermont House of Representatives from WoodstockIn office1853–1855Preceded byThomas E. PowersSucceeded byThomas E. PowersReporter of Decisions for the Vermont Supreme CourtIn office1844–1852Precede...

 

Strategi Solo vs Squad di Free Fire: Cara Menang Mudah!