Designing Your Own Language
What are your target enviornments
- Perl does text processing
- C trys to be simple and fast
- Java trys to be useful for a wide varity of tasks, and be safe
doing it.
- PHP is optimized for web pages.
Syntax Issues
- Many languages use ';' to divide statements.
- Python uses \n to divide statements
- Many langauges use {} to group statements
- Python uses indenting to group statments
- C++ and Java use // to indicate comments
- Perl and PHP use # to indicate comments
- C++ uses /* */ to indicate a block comment
Paradym Issues
- Many languages are object oriented.
- Java requires you to use objects.
- C++, C, and Java require you to make methods.
- Perl, PHP, and Python do not require you to make any methods.
- C++ and Java require you to include or import files.
- Perl and Python don't require you to import files.
Variable Issues
- Perl defaults to global variables.
- Many languages decide the scope of a variable by location of
declaration or first use.
- C++ and Java require that variables be declared before use.
- Python and PHP require no variable declarations.
- C++ and Java require that variables be given a type.
- PHP and Python have variables of 'flexible type'.
- Perl uses a special charactor to declare that a token is a
variable, and the type of the variable.
- Python uses a special charactor to declare that a token is a
variable, but not it's type.
- Java and C++ require all variables to be declared before use.
- C++ has variables that that can very in size, but can be adapted
to the CPU.
- Java has fixed sized variables that cannot be adapted.
Data Structures
- Almost every language has arrays.
- Every language except C has string as a builtin type.
- Python and Lisp have 'set' as a basic data type.
- Perl and PHP have 'Associative Array' as a basic data type.
Control Structures
- Python has an exit clause for 'for' loops.
- Perl allows a for loop to iterate over an array
for $i @array
- Python allows a for loop to iterate over a list
for i in list
Methods
- In Java, every method must be part of a class.
- In most languges, methods can stand alone.
- In most languages, parameters are indicated by order within the
method call.
- In Python, parameters can be indicated by name.
foo(a, b, type=c)
- In Perl, variables in a method are by default global.
Special Features
- Perl and Python have strong regular expression features.
- Python has lots of ways