scriptbox

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

DslAstParser.class.php (436B)


      1 <?php
      2 namespace dsl;
      3 
      4 use dsl\ast\DslStatementList;
      5 
      6 /**
      7  * Creates and interprets an abstract syntax tree (AST).
      8  */
      9 class DslAstParser
     10 {
     11 	/**
     12 	 * @var DslStatementList
     13 	 */
     14 	public $rootStatement;
     15 
     16 	/**
     17 	 * @throws DslParserException
     18 	 */
     19 	public function parse($tokens ) {
     20 
     21 		$this->rootStatement = new DslStatementList( $tokens );
     22 	}
     23 
     24 
     25 	public function execute($context)
     26 	{
     27 		return $this->rootStatement->execute( $context );
     28 	}
     29 
     30 
     31 }