Several DSL examples implemented based on the boo language can be used as a reference for our learning.
Brail
Castle Project
Http://www.castleproject.org/monorail/documentation/trunk/viewengines/brail/index.html.
It's a text templating language, built by me, in which in you can mix code and text freely. Here's a sample:
Rhino ETL
Rhino ETL employs the concept of steps, with data flowing from one step to the next.
Usually t
Keywords
Boo syntax
C # equivalent
Class car:PassPass keyword
Public class car{}
Employee is null
Employee = NULL
"Foo" is "bar"Employee ISA Manager
Referenceequals ("foo", "bar ")Employee is Manager
Employee is not null
Employee! = NULL
Not employee. istemporary
! Employee. istemporary
Employee is not null andEmployee ISA Manager
Employ
Http://blog.csdn.net/idisposable
First eye on Boo Language
On the. NET platform, in addition to ironpython, Python also has another relative, boo.
But the boo language is not really the Implementation of The Python language, it just has the same coat as Python.
========================================================== ==============================
Below are m
Objective:Again came to the weekend, little Bastard also finally have a breath to write blog time and energy. In the afternoon of Friday, Little bastard accidentally shook a bull's QQ group, and saw a unity3d development Laosheng long talk, "My development language is to choose JavaScript?" Or is it C #? ”。 To this question, small bastard also think really should carefully comb a bit. So why does the debate between JavaScript and C # not exist at all? First, we need to know what the JS script in
the pin seems a bit redundant, but still too lazy to delete qaq,//Initial code (BFS version)varHead,tail:longint; //Head to tail pointer temp:longint; I,n,a,b,sum:longint; Num:Array[1.. $] ofLongint; F:Array[0..201] of Record//record type, data is used to record the number in the queue, the pin is used to record how many data:longint have been gone; Pin:shortint; End; Boo:Array[1.. $] ofBoolean;//-------------------------------------------------procedureprintf (uuu:longint);
CompilationClassLoader
To use CCL, you must call the program in a special way. You cannot directly run this program, for example, % java Foo arg1 arg2.
Run it as follows:
% Java CCLRun Foo arg1 arg2
CCLRun is a special stub program. It creates CompilingClassLoader and uses it to load the main class of the program to ensure that the entire program is loaded through CompilingClassLoader. CCLRun uses the Java Reflection API to call the main method of a specific class and pass the parameter to
Apart from syntax, there are some differences when writing scripts in C # Or boo. Most notable are:
In addition to syntax rules, there are some differences between using C # Or boo to write scripts. When you need to pay special attention:
1. inherit from monobehaviourInherited from monobehaviour
All behaviour scripts must inherit from monobehaviour (directly or indirectly ). this happens automatically in Ja
post will explain the implementation of override to you from the underlying implementation perspective. First, let's clarify two concepts:
1. Call methods of a class instance are all virtual calls (callvirt) and only real calls are called when the base class methods are called ). See the Code:
1. Class2 .{3. Public void BOO ()4 .{5. Console. writeline ("A: Boo ().");6 .}7. Public Virtual void Foo ()8 .{9.
functions
Generally, the code of a function with the same name is rewritten within the function, for example:
VaRScareme =Function() {Alert ("Boo! "); Scareme=Function() {Alert ("Double Boo! ");};};
This code is very confusing. Let's take a look at the execution results of the example:
// 1. Add new attributes Scareme. Property = "properly" ; // 2. scareme is associated with a new value. VaR
Reflection operationsWhat is the reflection operator, in fact, is reversed two objects, the following first look at the implementation of a common runner:classFoo (object):def __init__(self, x): self.x=xdef __add__(self, Other):return 'foo:%s +%s'%(self.x, other.x)classBoo (object):def __init__(self, x): self.x=xdef __add__(self, Other):return 'boo:%s +%s'%(self.x, other.x) a= Foo (123) b= Boo (321)PrintA +
Boolean objects are simple but useful, but are also listed as a chapter.
The Boolean object is similar to the Boolean encapsulation class in Java. It has two values: true and false.1. Create a Boolean objectVar boo = new Boolean (); // boo is not assigned at this time, but its default value is false.Var boo = new Boolean (true );Var
Assert is a new feature introduced in j2se1.4. assertion is a Boolean State included in the Code. Programmers think this state is true. Generally, assert checks program security during development and generally does not use assert during release. Added support for the assert keyword and Java. Lang. asserterror class in 1.4.
First, we need to start with assert from an example.
Public class asserttest{Public static void main (string [] ARGs){Asserttest at = new asserttest ();At. assertme (true );A
Public class diliuzhou_1 {/*** @ Param ARGs */public static void main (string [] ARGs) {// todo auto-generated method stub} class trangle {double sidea, sideb, sidec, area, length; Boolean boo; Public trangle (double A, double B, double C) {sidea = A; // parameter A, B, C is assigned to sidea, sideb, sidec sideb = B; sidec = C; if (a + B> C A + C> B B + C>) // condition expression {boo = true for A, B, an
Once you assign a function object to a variable, you can define the function again by this variable, and even define itself again within a function:var scareme = function () { alert ("Boo!"); Scareme = function () { alert ("Double boo!"); };};/ /Using the self-defining functionscareme (); Boo!scareme (); Double
Tags: HTTP use AR strong SP on ef bs line
1. Create a regular expression in either of the following ways:VaR exp1: Regexp = new Regexp ("ABCD", "G ");VaR exp2 =/ABCD/g; // G Global indicates global match
Trace ("abcdefabcd". Match (exp1 ));Trace ("abcdefabcd". Match (exp2); // output ABCD and ABCD, where the string. Match (expression) returns a matched array.
2. metacharacters1) "." indicates matching any single character (such as: 1, E, medium, *, etc.). It can be a number, letter, Chinese cha
members specified by new are actually irrelevant to the members with the same name as the base class, i'm sorry, but I have to declare that this print is not another print. If you try to use new to create the trick illusion, you will eventually miss your front teeth. Before I give an example of "hitting your front teeth", please allow me to give a scenario where the new keyword is correctly used.
I wonder if you have actually studied interfaces in. NET Framework? If you have studied it, the f
Grep command series: How to Use grep commands in Linux/UNIX
How can I use the grep command in Linux, Apple OS X, and other UNIX-like systems? Can you give me some simple examples?
The grep command is used to search for text, or to search for a file containing a given string or word in a row from a given file. In general, grep displays the matched rows. Use grep to search for text rows that match one or more regular expressions, and then show only matched rows. Grep is regarded as one of the most
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.