File modules/dsl/DslAstParser.class.php

Last commit: Sun Jun 26 15:46:54 2022 +0200	Jan Dankert	Fix: Another, little better, hack for parameterless functions. Shunting yard seems to be unable to handle empty parentheses.
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 }
Download modules/dsl/DslAstParser.class.php
History Sun, 26 Jun 2022 15:46:54 +0200 Jan Dankert Fix: Another, little better, hack for parameterless functions. Shunting yard seems to be unable to handle empty parentheses. Wed, 1 Jun 2022 00:11:40 +0200 Jan Dankert New: DSL as a filter for number values Tue, 31 May 2022 00:32:27 +0200 Jan Dankert New: More context objects for the DSL Sun, 29 May 2022 01:13:27 +0200 Jan Dankert New: DSL with support for functions Sat, 28 May 2022 18:00:13 +0200 Jan Dankert New: DSL with a much better syntax parsing and support for assignments, conditions, ... Wed, 25 May 2022 22:47:17 +0200 Jan Dankert New: DSL (domain specific language) for code elements. The old way with PHP code ist not sandboxed and unsecure. This approach is a minimalistic, javascript-like, scripting engine. For now only simple function calls are possible, for example: alert("example");