Dashboard > USF Computer Science 652 - Programming Languages > ... > Labs > Grammars galore
  USF Computer Science 652 - Programming Languages Log In | Sign Up   View a printable version of the current page.  
  Grammars galore
Added by Terence Parr, last edited by Terence Parr on Jan 15, 2008  (view change)
Labels: 
(None)

Introduction

Being able to build a grammar from a short description or exemplar is an important skill for language tools developer to have. In these exercises you will build a variety of grammars in order to get use to doing this. Use ANTLRWorks and tester grammars with either the interpreter or the debugger.

Expressions

Build an expression evaluator that has integers as atoms with the following mythical binary operators and precedence.

operator precendence
# highest
_ $ 2nd highest
@ lowest

Allow parentheses to group expressions. Examples: 2 $ 3 # x and (2$3)#x.

Function lists

f()
g(3)
h(3,4)
f(g(3,4), 5)
Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.1 Build:#806 May 06, 2007) - Bug/feature request - Contact Administrators