Institute of Computer Science
  1. Courses
  2. 2017/18 spring
  3. Automata, Languages and Compilers (LTAT.03.006)
ET
Log in

Automata, Languages and Compilers 2017/18 spring

  • Üldinfo
  1. Õppekorraldus
  2. Eksam
  3. Reeglid
  4. Töövahendid
  5. Projekt
  • Kava
  1. Soojendus
  2. Regulaaravaldised
  3. Olekumasinad
  4. Lõplikud automaadid
  5. Avaldise struktuur
  6. Grammatikad ja lekser
  7. Käsitsi parsimine
  8. ANTLR intro
  9. AST loomine
  10. Interpretaator
    1. Eksami põhiosa
    2. Interpreter pattern*
    3. Kodutöö
  11. Semantiline analüüs
  12. Kompilaator
  • Moodle
  • Bitbucket
  • Fleep!

10. kodutöö: AKTK interpretaator

Olles kirjutanud grammatika ja loonud AST-i, oleme lõpuks jõudnud nii kaugele, et saame hakata käivitama AKTK programme! Hetkel piirdume interpreteerimisega, milleks on vaja implementeerida järgnev klass:

package week10;

public class AktkInterpreter {
	public static void run(String program) {
		// TODO: käivita antud AKTK kood
	}
}

Kodutöö mall on avalikus repos. Etteantud on abiklass week10.AktkInterpreterBuiltins, mis sisaldab AKTK "standardteeki", st. neid funktsioone, mis on kõigile AKTK programmidele alati kättesaadavad.

Vihjed

  • Muutujatega töötamiseks peaks kasutama nimeruume.
  • Kuigi AKTK programmides võib (aga ei pruugi!) esineda muutujate jms tüüpe, võib neid hetkel ignoreerida ja alati lähtuda väärtuste endi tüüpidest.
  • AktkInterpreterBuiltins kasutamiseks: https://docs.oracle.com/javase/tutorial/reflect/
  • Kui jääd hätta AKTK funktsioonide return-lausete implementeerimisega, siis ühe võimalusena uuri, kuidas toimub funktsioonist väärtuse väljaandmine Pascalis.
  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment