You are on page 1of 2

Systems Engineering Program

Subject Compilers
Professor Fran Ernesto Romero
Activity Workshop No. 3: LL1 Grammars

1. Goals

 Strengthen the knowledge acquired around alphabet, language and grammar concepts.
 Learn how to implement the recursive descent analysis algorithm.
 Understand the relationship between lexical and syntactic analysis.

2. Approach

We need to develop a Domain-Specific Language to support research on Covid-19. This


language will be based in rules, in the form "IF <Conditions> THEN <Actions>".

An atomic condition can only be in one of the following ways:

• X == Y
• X <> Y
• X> Y
• X <Y

Conditions can be composed using the AND and OR operators. For example:
(Fever > 31 AND Days > 2) OR BreathingFrequency < 15

Atomic and compound conditions can appear in parentheses.

Variable names can be words without accent marks, eñes, spaces or numbers.

Variables can only take integer numeric values.

Actions correspond to expressions of the form: procedure (number). For example,


increaseTemperature (10).

A rule would look like this:

If [(Fever > 31 AND Days > 2) OR BreathingFrequency < 15] Then


ScheduleAppointment (1)
MedicationTreatment (5)

Finally, a file can have several rules.

It is requested:
• Define a LL1 grammar –no-terminals, terminals, axioms, productions- for the described
language.

• Develop a parser (and a lexer) for your grammar.

You can develop the exercise using XText and get an extra grade
https://www.eclipse.org/Xtext/

3.General conditions

 The presentation is individual


 Use the programming language of your choice.
 There will be a practical exam to validate the development of the workshop

You might also like