Вы находитесь на странице: 1из 10

POLITEKNIKONG UNIBERSIDAD NG PILIPINAS

WARM
Proposal in Principles of
Programming Language

Submitted by:
Wesley Florentino
Arjel Joseph Aya-ay
Ryan Matthew Castillejo
Mariz Genelyn Jose

BSCS 2-4

Prof. Jude Mikhael Cruz


January 7 2015

POLITEKNIKONG UNIBERSIDAD NG PILIPINAS


I.

Introduction
Description

WARM is a general purpose programming language, an easy to learn, fast and


simple. It is an imperative programming, designed for students to solve complex
problem.
WARM is based mainly on the C programming and influenced by the other
features of Java and Python. It intended to help programmers to code at ease by means
of simplifying some syntax and providing a good library.
It is a new innovative language which has a concise syntax. WARM was
actually derived from the initials of the developers of this programming language which
is Wesley, Arjel, Ryan and Mariz.

II.

11 Syntactical Design

1. Character set
A Character set is a defined list of uppercase and lowercase alphabets,
digits, punctuation, and a few miscellaneous symbols that will be used in the
program.

A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
a
b
c
d
e
f
g

uppercase letter a
uppercase letter b
uppercase letter c
uppercase letter d
uppercase letter e
uppercase letter f
uppercase letter g
uppercase letter h
uppercase letter i
uppercase letter j
uppercase letter k
uppercase letter l
uppercase letter m
uppercase letter n
uppercase letter o
uppercase letter p
uppercase letter q
uppercase letter r
uppercase letter s
uppercase letter t
uppercase letter u
uppercase letter v
uppercase letter w
uppercase letter x
uppercase letter y
uppercase letter z
lowercase letter a
lowercase letter b
lowercase letter c
lowercase letter d
lowercase letter e
lowercase letter f
lowercase letter g

h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
0
1
2
3
4
5
6
7
8
9
!
"
}

lowercase letter h
lowercase letter i
lowercase letter j
lowercase letter k
lowercase letter l
lowercase letter m
lowercase letter n
lowercase letter o
lowercase letter p
lowercase letter q
lowercase letter r
lowercase letter s
lowercase letter t
lowercase letter u
lowercase letter v
lowercase letter w
lowercase letter x
lowercase letter y
lowercase letter z
zero
one
two
three
four
five
six
seven
eight
nine
Space
Exclamation point
quotation mark
right curly bracket

_
%
&
{
(
)
*
+
,
.
/
:
|
<
=
>
?
[
\
]

low line
percent sign
ampersand
left curly bracket
left parenthesis
right parenthesis
asterisk
plus sign
comma
hyphen-minus
full stop
solidus
colon
vertical line
less-than sign
equals sign
greater-than sign
question mark
left square bracket
reverse solidus
right square bracket

POLITEKNIKONG UNIBERSIDAD NG PILIPINAS


2. Identifiers
Identifiers are the names that are given to various program elements
such as variables, symbolic constants and functions.
Rules for constructing identifiers
An identifier can be composed of uppercase or lowercase letters, digits and
underscores only.
No spaces in between words only underscore.
Identifiers cannot start with a digit, a reserved keyword, or an underscore.
Identifiers are case sensitive.
No special characters, such as semicolon, period, blank space, slash or
comma are permitted
Identifiers cannot be a keyword or a reserved word.
Invalid Identifier
1Dev
#*$Compute
For
Two Times

Valid Identifiers
Example
COUNTER
test123
The_File_executes

Finite State Machine ( Identifiers )

Letters, Digit,
Underscore

Letters

Start

q1

q0
Digits,and
Symbols,
Digits
special
Reserved
symbols words

q2
Digits and special
symbols

Special symbols

q3

POLITEKNIKONG UNIBERSIDAD NG PILIPINAS

3. Reserved Words or Keywords


Description
boolean
constant
else
if
void

case
do
for
break
continue
float
int
return

while
char
double
switch
default

Boolean variables can only be assigned


the values true or false
Data modifier that prevents a variable
from being changed.
Statement signaling alternative
statements to be executed when an if
statement evaluates to FALSE.
Command used to change program flow
based on a TRUE/FALSE decision.
Keyword used to signify either that a
function doesn't return anything or that a
pointer being used is considered generic
or able to point to any data type.
Command used within the switch
statement.
Looping command used in conjunction
with the while statement. The loop will
always execute at least once.
Looping command that contains
initialization, incrementation, and
conditional sections.
Command that exits for, while, switch,
and do...while statements
unconditionally.
Command that resets a for, while, or
do...while statement to the next
iteration.
Data type used for floating-point
numbers.
Data type used to hold integer values.
Command that causes program flow to
exit from the current function and return
to the calling function. It can also be
used to return a single value.
looping statement that executes a
section of code as long as a condition
remains TRUE.
The simplest data type.
data type that can hold double-precision
floating-point values.
Command used to change program flow
in a multitude of directions. Used in
conjunction with the case statement.
If none of the case clauses in a switch
statement match the switch expression,
execution of statements within the
switch block begins at the "default case"
or "default label".

POLITEKNIKONG UNIBERSIDAD NG PILIPINAS

Finite State Machine ( Keywords )

POLITEKNIKONG UNIBERSIDAD NG PILIPINAS


4. Noise words
No noise words in this programming language
5. Operational Symbols
Type of operators

Operator/s

Arithmetic
operator

+, -,

Assignment
operator

=, +=, -=, *=, %=

Logical operator

| | , && , !

Increment/
decrement
operator

++ , --

Conditional
operator
Relational
operator

*, /, %, **

?:

<, >, <=, >=, ==, !=

It is significant only in string literals

7. Delimiters and brackets


Symbol

Description

{ }
( )

Braces
Parenthesis calling
function,
subexpression
grouping

[ ]

Brackets, array
access
Semicolon
Comma
Dot

8. Free or fixed field format


It is a free-field format language.
9. Comments

These are used to perform


mathematical calculations like
addition, subtraction, multiplication,
division and modulus
These are used to assign the values
for the variables in C programs.
These operators are used to perform
logical operations on the given two
variables.
These operators are used to either
increase or decrease the value of the
variable by one.
Conditional operators return one
value if condition is true and returns
another value is condition is false.

6. Blank or spaces

;
,
.

Definition

These operators are used to compare


the value of two variables.

POLITEKNIKONG UNIBERSIDAD NG PILIPINAS


It is used to embed programmer-readable annotations in the source code of
a computer program.
Symbol

Definition

Single line comment


Example:
# This is sample program
# program is running
# warm programming.

Symbol

Definition

/* */
Multi-line comment
Example:
/* This is sample program
program is running
warm programming. */

10. Expressions
Precedence order
When two operators share an operand the operator with the higher
precedence goes first. For example, 1 + 2 * 3 is treated as 1 + (2 * 3), whereas 1
* 2 + 3 is treated as (1 * 2) + 3 since multiplication has a higher precedence than
addition.
Associativity
When an expression has two operators with the same precedence, the
expression is evaluated according to its associativity. For example x = y = z =
17 is treated as x = (y = (z = 17)), leaving all three variables with the value
17, since the = operator has right-to-left associativity (and an assignment
statement evaluates to the value on the right hand side). On the other hand, 72 /
2 / 3 is treated as (72 / 2) / 3 since the / operator has left-to-right
associativity.
When operators of equal precedence appear in the same expression, a
rule must govern which is evaluated first. All binary operators except for the
assignment operators are evaluated from left to right; assignment operators are
evaluated right to left.

Operator Precedence

POLITEKNIKONG UNIBERSIDAD NG PILIPINAS


Operators

Precedence

Postfix

expr++ expr--

Prefix

++expr --expr!

multiplicative

* / %

additive

+ -

relational

< > <= >=

equality

== !=

logical AND

&&

logical OR

||

Ternary

? :

assignment

= += -= *= /=

11. Statement
Assignment Statement
This statement changes the value of the variable on the left side of the
equals sign to the value of the expression on the right-hand side.
The variable is often just specified by a variable name, but there are also
expressions that specify variables.
Example:
int x = 5.
char initial = a.
float y = 10.05.
Compound Statement
These statements are groups of statements enclosed in curly braces ({ }).
They can be used wherever a single statement may be used.
Input Statement
Example:
read(%d,&x ).
Output statement
Example:
write(Hello World).
Selection statement
These statements perform a test; they then execute one section of code if
the test evaluates to true (nonzero). They may execute another section of
code if the test evaluates to false.
if statement
Example:
if(x == y){
write(This statement is true).
}

switch statement
Example:

POLITEKNIKONG UNIBERSIDAD NG PILIPINAS


switch(menu){
case 1: write(You pressed 1).
case 2: write (You pressed 2).
}
Iteration statement
These statements provide for repeated execution of a block of code until
a specified termination criterion is met.

do-while loop
Example:
do{
write(This statement has been writeed).
x = x + 1.
}while(x<=5).

while loop
Example:
while(x==5){
x++.
write( Live your life).
}
for loop
Example:
for(int i = 0. i < 10. i++){
write(I am a programmer).
}

Jump Statement
These statements transfer control unconditionally
continue
break
Example:
switch(Menu){
case 1: write(case 1).
case 2:{
write(case 2).
break..
}
}

return
addfunction(int x){
x = x + y.
return x.
}

POLITEKNIKONG UNIBERSIDAD NG PILIPINAS


References:
https://docs.python.org/2/reference/
http://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html#Expressionsand-Operators
http://joequery.me/code/programming-language-translation-issues/
http://fresh2refresh.com/c/c-operators-expressions/
http://en.wikipedia.org/wiki/C_(programming_language)#Syntax
http://en.wikipedia.org/wiki/Java_syntax#Jump_statements
http://en.wikipedia.org/wiki/Python_syntax_and_semantics#Operators
http://www.programiz.com/c-programming/c-keywords-identifier
http://www.c4learn.com/c-programming/c-conditional-operators/
http://www.c-lang.thiyagaraaj.com/tutorials/c-basics/c-reserve-words
http://introcs.cs.princeton.edu/java/11precedence/

10