Bison parser on MSX: ROM, sources and Howto

by andrear1979 on 19-05-2008, 00:53
Topic: Development
Languages:

Andrea Rossetti from Italy wrote a brief tutorial on how to build a Bison parser for MSX using the SDCC cross-compiler; the resulting .ROM program can read an input sequence, do a syntax check and perform actions on specific subgroups of tokens.

Possible applications that may benefit of a Bison parser are (among others) textual adventure games, compilers, interpreters and loaders of formatted data for game levels. Tutorial, source code and an example ROM file are available at andrear's website.

Relevant link: andrear's website

Comments (4)

By pitpan

Prophet (3097)

pitpan's picture

19-05-2008, 08:22

Whow. Never expected to find Bison available for MSX! Bison (and Flex) are the core of asMSX. Is this an omen for an upcoming asMSX native MSX version? I doubt it, but it is cool to know that such possibility exists.

By andrear1979

Expert (92)

andrear1979's picture

19-05-2008, 09:35

I would remark that Bison parsers were immediately compilable on SDCC, without changes to the intermediate C file.

I think it should work as well with flex, but I wasn't able to reach the same results, the C source gives many errors with SDCC. My parser uses only Bison and a simple handmade tokenizer at the moment.

My next experiments might be devoted to try using Flex on MSX, I'll keep MRC informed about it.

Sincere regards, Andrea

By ARTRAG

Enlighted (5826)

ARTRAG's picture

21-05-2008, 16:24

Why not trying a more enjoying port ?

Do you know angband ? It is a nice D&D game with simple graphic (even in ASCII)

It's C sources are free and online.

look e.g. here http://www.google.com/codesearch?hl=en&q=show:WrcI7R5662I:070TbDU8sS4&sa=N&ct=rdp&cs_p=http://ftp5.ru.freebsd.org/pub/FreeBSD/distfiles/tome-232-src.tar.bz2

and it can fit for sure in a rom.

By ARTRAG

Enlighted (5826)

ARTRAG's picture

22-05-2008, 14:16

My MSX profile