Questions tagged [lex]

Lex is a computer program that generates lexical analyzers ("scanners" or "lexers"). Lex is commonly used with the yacc parser generator.

Filter by
Sorted by
Tagged with
5 votes
2 answers
529 views

CSV to TSV converter in C+yacc+lex and a Makefile

This is Comma-Separated Values to Tab-Separated Values converter written in C, with yacc(1) and lex(1). I'm remembering how to use yacc (the first (and last) time I used it was while reading «The UNIX ...
CancelVanDePaar's user avatar
2 votes
0 answers
65 views

implementing lexical, syntatic and semantic analysis

My program , developed with C using win_flex , implements lexical, syntatic and semantic analysis , given defined grammar rules. I would like to know if you any suggestion for improving or ...
Amiram Goldblum's user avatar
1 vote
1 answer
1k views

Lex code to convert C for and do while loops into while loops [closed]

This is my lex code to convert possibly nested for and do while loops into while loops. (Other control flows like if or switch ...
Shantanu Shinde's user avatar
6 votes
0 answers
396 views

Creating a new language: FreezeFlame

Where it shines FreezeFlame shines in readibility while still maintaining most of the C-like syntax. It also implements a few (Planning on several) operators that are still in testing for other ...
FreezePhoenix's user avatar
2 votes
0 answers
58 views

Lex simple line-counting grammar

I'm trying to make a lex (flex) grammar that kicks out tokens while always being aware of the current line number. As an exercise, I made a simple grammar that accepts raw strings ...
Greg Nisbet's user avatar
2 votes
0 answers
74 views

Parsing key:value metadata in a file

I have written some Flex and Bison code for parsing a file. The following is a simplified example of the input file as well as the code used for parsing. There are a few things I am not satisfied ...
exilit's user avatar
  • 189
4 votes
1 answer
3k views

Yet another C++ Json Parser (Recursive)

Following on from this request Yet another C++ Json Parser A friend pointed out that he though a recursive decent parser would be more efficient. Before I agree I want to test it so I wrote it for ...
Martin York's user avatar
  • 93.9k
49 votes
1 answer
7k views

Yet another C++ JSON parser

This is a framework for a JSON parser I put together last night. Any comments appreciated. JsonLexer.l: Breaks the input into lexemes JsonParser.y: Understands the language syntax JsonParser.h: ...
Martin York's user avatar
  • 93.9k