Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1819 > unrolled thread

some guideline to lexer or parser

Started bychano <noemail@no.spam.com>
First post2017-02-27 04:53 +0000
Last post2017-03-01 09:27 -0800
Articles 5 — 5 participants

Back to article view | Back to comp.compilers


Contents

  some guideline to lexer or parser chano <noemail@no.spam.com> - 2017-02-27 04:53 +0000
    Re: some guideline to lexer or parser George Neuner <gneuner2@comcast.net> - 2017-02-27 15:39 -0500
    Re: some guideline to lexer or parser Hans Aberg <haberg-news@telia.com> - 2017-02-27 18:51 +0100
    Re: some guideline to lexer or parser Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2017-02-28 11:25 +0100
    Re: some guideline to lexer or parser "SLK Mail" <slkpg4@gmail.com> - 2017-03-01 09:27 -0800

#1819 — some guideline to lexer or parser

Fromchano <noemail@no.spam.com>
Date2017-02-27 04:53 +0000
Subjectsome guideline to lexer or parser
Message-ID<17-02-005@comp.compilers>
is there any guideline document on simple lexer or parser on the internet?
I try to build routine to parse simple < data, data, data > format and I
find it it's no easy task

[There's Crenshaw's Let's Build a Compiler which is 20 years
old but still pretty good. -John

ftp://ftp.iecc.com/pub/file/crenshaw-txt.zip
]

[toc] | [next] | [standalone]


#1820

FromGeorge Neuner <gneuner2@comcast.net>
Date2017-02-27 15:39 -0500
Message-ID<17-02-006@comp.compilers>
In reply to#1819
On Mon, 27 Feb 2017 04:53:24 +0000 (UTC), chano <noemail@no.spam.com>
wrote:

>is there any guideline document on simple lexer or parser on the internet?
>I try to build routine to parse simple < data, data, data > format and I
>find it it's no easy task

Too complicated for regex?


>[There's Crenshaw's Let's Build a Compiler which is 20 years
>old but still pretty good. -John
>
>ftp://ftp.iecc.com/pub/file/crenshaw-txt.zip
>]


There are a number of guides to writing parsers, but they necessarily
are language specific (which the OP didn't mention) and many are above
beginner level.

Maybe these?

C:
https://stlab.adobe.com/wiki/index.php/How_To_Write_A_Simple_Lexical_Analyzer_or_Parser
Python:
http://parsingintro.sourceforge.net/
Java:
http://cogitolearning.co.uk/?p=523


George

[toc] | [prev] | [next] | [standalone]


#1821

FromHans Aberg <haberg-news@telia.com>
Date2017-02-27 18:51 +0100
Message-ID<17-02-007@comp.compilers>
In reply to#1819
On 2017/02/27 05:53, chano wrote:
> is there any guideline document on simple lexer or parser on the internet?

Bison has a simple calculator which is good to start with, available
both in C and C++, also described in the manual.
   https://www.gnu.org/software/bison/

> I try to build routine to parse simple < data, data, data > format and I
> find it it's no easy task

If it is very simple, some other computer facility might suffice.

[toc] | [prev] | [next] | [standalone]


#1822

FromHans-Peter Diettrich <DrDiettrich1@netscape.net>
Date2017-02-28 11:25 +0100
Message-ID<17-03-001@comp.compilers>
In reply to#1819
Am 27.02.2017 um 05:53 schrieb chano:
> is there any guideline document on simple lexer or parser on the internet?
> I try to build routine to parse simple < data, data, data > format and I
> find it it's no easy task

Are you interested in theory or practice?

In practice almost every programming language offers means for string
handling, so that you can read a line of characters, or characters
delimited by < and >. Then find the , in the string, and convert the
characters in between.

DoDi

[toc] | [prev] | [next] | [standalone]


#1824

From"SLK Mail" <slkpg4@gmail.com>
Date2017-03-01 09:27 -0800
Message-ID<17-03-003@comp.compilers>
In reply to#1819
Lexing is not hard. If simple enough, you might even use the C library
strtok() to tokenize. Re2c is another C possibility.

If the grammar is recursive, then recursive descent might be fairly easy
to learn.

For simple grammars, I still think a parser generator like SLK is the
quickest way to get it done in C, C++, C#, Java, or Javascript.

The SLK Parser Generator - http://www.slkpg.com

[toc] | [prev] | [standalone]


Back to top | Article view | comp.compilers


csiph-web