Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where to find a real example on flex and bison?

Tags:

bison

lex

i need a n example on flex and bison , so i can learn how to build ast tree and symbol table and do semantic analysis

like image 414
Radi Avatar asked Jan 20 '10 06:01

Radi


People also ask

What is flex and bison in programming?

Flex and Bison are tools for building programs that handle structured input. They were originally tools for building compilers, but they have proven to be useful in many other areas.

What is the difference between flex and bison?

Flex and Bison are two separate software. Even though they are designed to work together there are compatibility issues and incompatible features. For example, Bison supports the generation of parser in C, C++ and Java, while Flex only supports C well.

What is $$ in Bison?

If there were a useful semantic value associated with the `+' token, it could be referred to as $2 . If you don't specify an action for a rule, Bison supplies a default: $$ = $1 . Thus, the value of the first symbol in the rule becomes the value of the whole rule.


2 Answers

This link: Using Flex and Bison is really good. It describes how they work and afterwards explains step-by-step how to build a small programming language.

like image 114
Alex Ntousias Avatar answered Oct 05 '22 03:10

Alex Ntousias


PostgreSQL: http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/

like image 45
Peter Eisentraut Avatar answered Oct 05 '22 01:10

Peter Eisentraut