Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.219.126.46
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/self/root/usr/share/doc/libparse-recdescent-perl/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/self/root/usr/share/doc/libparse-recdescent-perl/examples/demo_recipe.pl
#!/usr/bin/perl -sw

# "Potato, Egg, Red meat & Lard Cookbook",
# T. Omnicient Rash & N. Hot Ignorant-Kant
# O'Besity & Associates

use Parse::RecDescent;

$grammar =
q{
	Recipe: Step(s)

	Step:
		Verb Object Clause(s?)
			{ print "$item[1]\n" }
	      | <resync:[ ]{2}>

	Verb:
		'boil'
	      | 'peel'
	      | 'mix'
	      | 'melt'
	      | 'fry'
	      | 'steam'
	      | 'marinate'
	      | 'sprinkle'
	      | 'is'
	      | 'are'
	      | 'has'

	Object:
		IngredientQualifier(s) Ingredient
	      | ReferenceQualifier(s) Ingredient
	      | Reference

	Clause:
	        SubordinateClause
              | CoordinateClause

	SubordinateClause:
		'until' State
	      | 'while' State
	      | 'for' Time

	CoordinateClause:
		/and( then)?/ Step
	      | /or/ Step

	State:
		Object Verb Adjective
	      | Adjective

	Time:
		Number TimeUnit

	TimeUnit:
		/hours?/
		/minutes?/
		/seconds?/

	QuantityUnit:
		/lbs?/


	Object:
		ReferenceQualifier Ingredient
	      | Reference

	Reference:
		'they'
	      | 'it'
	      | 'them'

	Ingredient:
		'potatoes'
	      | 'lard'
	      | 'olive oil'
	      | 'sugar'
	      | 'bacon fat'
	      | 'butter'
	      | 'salt'
	      | 'vinegar'

	IngredientQualifier:
		Amount
	      | Number
	      | 'a'
	      | 'some'
	      | 'large'
	      | 'small'

	Amount: Number QuantityUnit

	ReferenceQualifier:
	        'the'
	      | 'those'
	      | 'each'
	      | 'half the'

	Number:
		/[1-9][0-9]*/
	      | /one|two|three|four|five|six|seven|eight|nine/
	      | 'a dozen'

	Adjective:
		'soft'
	      | 'tender'
	      | 'done'
	      | 'charred'
	      | 'grey'

};

$parse = new Parse::RecDescent ($grammar);

$/ = "\n\n";
while (<DATA>)
{
	if($ingredients = $parse->Recipe(lc $_))
	{
		print "$ingredients\n$_";
	}
}

__DATA__
Boil six large potatoes until they are grey and then marinate them
for at least two hours in a mixture of lard, olive oil, raw
sugar, and sea-salt.  In a deep-fryer melt 2 lbs of bacon fat and
bring to the boil.  Fry the marinated potatoes for 7 minutes, or
until they are nicely charred.  Serve with lashings of butter.
Sprinkle with salt and vinegar to taste.

Anon7 - 2022
AnonSec Team