Nothing Special   »   [go: up one dir, main page]

0% found this document useful (0 votes)
76 views4 pages

Jessa Jane S. Romo Bsit-2 Javascript Perl: Elements Character Set

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 4

Jessa Jane S.

Romo BSIT-2
Elements JavaScript PERL Visual Basic .NET
Character Set  The uppercase letters 'A' through 'Z' ASCII /[a-z]/, /[A-Z]/, /[0-9]/, /,’\.\?]/, /[A-Za-z/, /[A-Za- Character ::= < any Unicode character
('\u0041' through '\u005a'), zO-9]/, /[^a-z]/, /[^0-9/ except a LineTerminator >
 The lowercase letters 'a' through 'z'
('\u0061' through '\u007a'),
 The digits '0' through '9' ('\u0030' through '\u0039'),
 The dash character '-' ('\u002d', HYPHEN-MINUS),
 The period character '.' ('\u002e', FULL STOP),
 The colon character ':' ('\u003a', COLON), and
 The underscore character '_' ('\u005f', LOW LINE).

Identifiers Every name is made from the following characters, starting with #!/usr/bin/perl Visual Basic .NET identifiers conform to the Unicode
a letter:
$sessionId =""; Standard Annex 15 with one exception: identifiers
 Letters: a-z, A-Z, and other alphabetic characters from $length=16; may begin with an underscore (connector) character.
other languages. If an identifier begins with an underscore, it must
for($i=0 ; $i< $length ;)
 Digits: 0-9 { contain at least one other valid identifier character to
 Special: _ (underscore) $j = chr(int(rand(127))); disambiguate it from a line continuation.
if($j =~ /[a-zA-Z0-9]/)
No names can be the same as a Java keyword { Regular identifiers may not match keywords, but
(eg, import, if, ...). $sessionId .=$j;
escaped identifiers can. An escaped identifier is an
$i++;
} identifier delimited by square brackets. Escaped
} identifiers follow the same rules as regular identifiers
except that they may match keywords and may not
print $sessionId; have type characters.

It's that simple. You can change the combination of letters Identifier ::=
and number used in the sessionId by changing this regular    NonEscapedIdentifier [ TypeCharacter ] |
expression /[a-zA-Z0-9]/. And change it's length with the
$length variable. The longer the identifier the more likely    EscapedIdentifier
that it's unique.

Operator Symbols + addition and String concatenation infix_operator::= "," | "=" | ".." | "||" | "&&" | "|" | "^" | Operator ::= & | * | + | - | / | \ | ^ | <
"&" | "<<" | ">>" | "+" | "-" | "." | "*" | "/" | "%" | "x" | | = | >
- subtraction "**" .
relational_operator::= "==" | "eq" | "!=" | "ne" | "<=>" |
star multiplication "cmp" | "<" | "lt" | ">" | "gt" | ">=" | "ge" | "<=" | "le".
pattern_binding_operator::= "=~" | "!~".
/ division assignment_operator::= "=" | infix_operator "=".
1. prefix::= "!" | "~" | "++" | "--" | "-".
% mod (remainder from integer division) 2. postfix::="++" | "--".

< less than

<= less than or equal

> greater than

>= greater than or equal

== equal

!= not equal

&& and

|| or

+ addition and String concatenation

Keywords & abstract boolean break byte case Keyword ::= < member of keyword table >
char class const continue default  The next keyword jumps directly to the end of the
Reserved words -AddHandler,AndAlso, Auto, ByVal, Cbool,
double else extends final finally current iteration of the loop. This usually causes the CDbl, Class, CShort, Date, Delegate,
for goto if implements import Double, End, Error, ..etc
int interface long native new next iteration of the loop to be started, but
private protected public return short
the continue block and loop condition are evaluated
strictfp super switch synchronized this
throws transient try void volatile first.

 The last keyword immediately terminates

execution of the loop identified by the label.

The continue block is not executed.

 The redo keyword restarts the current iteration of

the loop identified by the label. Neither

the continue block nor the loop condition is evaluated.


Comments // comments -- one line C_comment -  "/*" #character "*/". Comment ::= CommentMarker [ Character+ ]
Shell_comment -  "#" #non_end_of_line CommentMarker ::= SingleQuoteCharacter |
After the two // characters, Java ignores everything to the end
of the line. This is the most common type of comment. REM
//--comment--// SingleQuoteCharacter ::=
/* ... */ comments -- multiple lines    ' |
After the /* characters, Java will ignore everything until it finds    < Unicode left single-quote character
a */. This kind of comment can cross many lines, and is (0x2018) |
commonly used to "comment out" sections of code -- making    < Unicode right single-quote character
Java code into a comment while debugging a program. (0x2019)

Expression In Java, arithmetic, boolean, and String expressions are written Optional Expressions. An expression is a sequence of operators and
in conventional mathematical infix notation, adapted to the A part of an pattern can be made optional in a regular
standard computer character set (called ASCII). For example, expression with a ? operator. operands that specifies a computation of a value, or
the Scheme expression Example: that designates a variable or constant. This defines
(and (< (+ (* x x) (* y y)) 25) (> x 0)) RegEx: /[0-9]? This is sample/
is written in Java as Source Text1: /1 This is sample/ the syntax, order of evaluation of operands and
(x*x + y*y > 25) && (x > 0) SoCounted Expressions. operators, and meaning of expressions.
Like the C programming language, Java uses the symbol && for An interval expression, {m,n} where 'm' and 'n' are non- Expression ::=
the ``and'' operation on boolean values (true and false) and the negative integers with 'n >= m', applies to the proceeding    SimpleExpression |
symbol == for the equality operation on numbers. (The character, character set, subexpression or backreference.
symbols & and = are used in C and Java for other purposes.) It indicates that the preceeding element must match at    TypeExpression |
least 'm' times and may match as many as 'n' times.    MemberAccessExpression |
Alternative expression is a one which matches any of    DictionaryAccessExpression |
The arithmetic operators all use conventional computer
the specified list of patterns. This helps us to give OR    IndexExpression |
arithmetic appropriate for the types of the arguments.
conditions in our patterns.
Conventional computer arithmetic does not exactly conform to    NewExpression |
Example:
the standard mathematical conventions. For example, the    CastExpression |
RegEx: /(TEXT|text)/
expression    OperatorExpression
Source Text1: This is sample TEXT.
Source Text2: This is sample text.
5/3 Repeated Expressions.
produces the result To match a part of a pattern repeatedly for many times. It
1 is just like counted patterns but here it is more generic.
which is the quotient of 5 divided by 3. Integer division produces Operators used in Repeated Expressions:
an integer rather than rational result; it truncates to the decimal 1. * ( Asterix ) - Represents 0 or many times of matching.
representation of the rational result. Similarly, The expression 2. + ( Plus ) - Represents 1 or many times of matching.
5%3 Operator * represents that the pattern is optional and it
produces the result can come any times.
2 Operator + represents that the pattern is mandatory or
which is the remainder of 5 divided by 3. In Java program text, must and it can come any times.
spaces between symbols are ignored; the expression Example 1:
5/3 RegEx: /[0-9]+/
is equivalent to the expression Source Text1: 123 This is a sample text.
5/3 Result: It will match "123".
Statements <variable> = <expression>; A Perl statement ends with the semicolon character (;) The following code demonstrates where to place the
which is used to tell interpreter that the statement was Option statement.
complete. You can put one or more Perl statements on the
For Example:
same line of a Perl script or continue a statement on
several lines. Please look at the following example to see Option Strict Off
int height; some simple Perl statements: Imports System
height = 34; Module Module 1

2+4; Sub Main ()


$var1 = 2+4; $pi = 3.14; Console.WriteLine (“Using Option”)
$var = $var1 + End Sub
$pi;
End Module
Subprogram public static void main (String args[]){ 1. subprogram_declaration::= "sub" identifier ";". Vb.net supports two types of sub program:-
2. subprogram_definition::= "sub" identifier block, 1. Sub Procedure
note that the formal parameters are not declared 2. Function
public class Method1(){ as part of the subprogram. They are implicitly
Sub Procedure
available as "@_". The perl way to define a
subprogram with three arguments x,y,z is to It will perform a task without returning a value directly to
int var1=1;
write: calling environment
This is similar to function with return type “void” in c
public class Method2(){ sub foo{ language
local($x,$y,$z)=@_; Syntax:-
...
} sub procedurename ( ByVal/ByRef paraname as datatype,
...etc. —–)
3. local_declaration::= "local(" List(variable) ——————
")" O( initialization ) -- dynamic scoping. exit sub (similar to break statement in c language)
}
4. private_decalaration::= "my(" List(variable) ")" O( ——————
initialization ) -- static scoping, added in Perl 5. End sub
} 5. dangerous_shell_escape::="system("
os_command_line ")".
6. possibly_safe_shell_escape::="system("
}The JVM follows the methods to the innermost method and os_command "," arguments ")" -- ??.
executes any operations there, and if that method specifies 7. evaluate string::= "eval" "(" expression ")".
allows for returning results, passes the result to the nearest
outer method and continues computing each method until it
reaches the main method again.

Obviously, this is a very intricate form of programming, since


each method can contain any number of structures like loops or
branch statements, and there can be multiple subprograms.
References http://rx4ajax-jscore.com/ecmacore/operator/overview.html http://www.wellho.net/regex/perl.html, http://msdn.microsoft.com/en-
http://www.cs.rice.edu/~cork/book/node6.html http://www.wellho.net/regex/perl.html, us/library/aa711644(v=VS.71).aspx
http://www.csci.csusb.edu/dick/samples/perl.html
http://www.misc-perl-info.com/perl-statements.html
https://www.physiol.ox.ac.uk/Computing/Online_Documen
tation/Perl-5.8.6/index-functions-by-cat.html#Keywords-
related-to-perl-modules

You might also like