CITS2002 Systems Programming  
 

Unit home

Project 1

help2002

Lecture & Workshop
recordings on LMS

Schedule

FAQ

Unit outline

C textbooks

OS textbooks

Information resources


Extra reading

Past projects

Recent feedback


Working effectively

Look after yourself!

The cool programming language syntax — [...] zero or one,   (...)* zero or more

program:
        ( definition )*

definition:
           int IDENT [ "=" intconst ] ";"
        |  int IDENT "(" formalparams ")" block
        | void IDENT "(" formalparams ")" block

formalparams:
          void
        | int IDENT ( "," int IDENT )*

block:
        "{" ( definition | statement )* "}"

statement:
            definition
        |   block
        |  IDENT "=" expression ";"
        |     if "(" expression ")" block [ else block ]
        |  while "(" expression ")" block
        |  return [ expression ] ";"
        |  print  ( string | expression ) ";"
        |  IDENTvalue ";"

expression:
          term   [ ("+" | "-")  expression ]

term:
          factor [ ("*" | "/")  term ]

factor:
          intconst
        | IDENTvalue
        | "(" expression ")"

IDENTvalue:
          IDENT [ "(" actualparams ")" ]

actualparams:
          expression ( "," expression )*
        | empty

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Presented by [email protected]