Discussion:
Extremely simple programming language
(too old to reply)
R***@gmail.com
2006-05-09 13:44:42 UTC
Permalink
Hi. I'm looking for a very simple programming language. I would like to
teach a single lecture on programming concepts to media-ish students in
a first year "introduction to lots of different things" module. The
language should be very simple, and preferably the students should be
able to type in their simple programs to an applet or similar available
across the web.

My current plan is to write a bespoke language using JavaCC or similar,
and deploying it as an applet. This isn't a big problem for me as I've
written languages before. However, I thought I should ask around in
case something similar has been done before.

The language would have only the features:

typed variable declarations for int and float only.
assignment statements. Full BODMAS
if statements, including else and blocks
a while statement with
typed functions with typed arguments.
a print statement that can print out quoted strings, numerical
constants, and the contents of numerical variables, separated by commas
an input statement with an optional prompt that returns a single
numerical variable

And that would be it. The students would be primarily taught through a
single two hour lecture, and a two hour tutorial concentrating on
desk-checking very simple programs. Both stand-alone and web
interpreters would be available for their self-study.

The teaching aim is to "soften them up" a bit for when they, or some of
them, learn real programming languages of various types (C, Java,
Javascript, Lingo) in the second and later years.

Anybody got any langauges/systems to recommend before I roll my own?

Cheers,

Ross-c
Craig Carey
2006-06-27 07:11:45 UTC
Permalink
Post by R***@gmail.com
Hi. I'm looking for a very simple programming language. I would like to
teach a single lecture on programming concepts to media-ish students in
a first year "introduction to lots of different things" module. The
language should be very simple, and preferably the students should be
able to type in their simple programs to an applet or similar available
across the web.
The difficulty was too much. The word(s) "media-ish" can lower hopes.

It was not said if the proposed interpreter or compiler, can stop after
only doing syntax checking.
Post by R***@gmail.com
My current plan is to write a bespoke language using JavaCC or similar,
The teaching aim is to "soften them up" a bit for when they, or some of
I shall promote this Ada body file.

Source: http://gcc.gnu.org/viewcvs/trunk/gcc/ada/sem_ch8.adb

(Annotated Reference Manual Chapter 8 is named "Section 8: Visibility
Rules". OC Systems (www.ocsystems.com, Ada 83 for OS/390) has an HTML
AARM doc defining standards, online: http://www.ada-auth.org/)


| GNAT COMPILER COMPONENTS --
| --
| S E M . C H 8 --
...
| GNAT was originally developed by the GNAT team at New York University. --
| Extensive contributions were provided by Ada Core Technologies Inc. --
...
...

| the current inner scope) next. As a result, name resolution routines
| do not assume any relative ordering of the homonym chains, either
| for scope nesting or to order of appearance of context clauses.
|
| When compiling a child unit, entities in the parent scope are always
| immediately visible. When compiling the body of a child unit, private
| entities in the parent must also be made immediately visible. There
| are separate routines to make the visible and private declarations
| visible at various times (see package Sem_Ch7).
|
| +--------+ +-----+
| | In use |-------->| EU1 |-------------------------->
| +--------+ +-----+
| | |
| +--------+ +-----+ +-----+
| | Stand. |---------------->| ES1 |--------------->| ES2 |--->
| +--------+ +-----+ +-----+
| | |
| +---------+ | +-----+
| | with'ed |------------------------------>| EW2 |--->
| +---------+ | +-----+
| | |
| +--------+ +-----+ +-----+
| | Scope2 |---------------->| E12 |--------------->| E22 |--->
| +--------+ +-----+ +-----+
| | |
| +--------+ +-----+ +-----+
| | Scope1 |---------------->| E11 |--------------->| E12 |--->
| +--------+ +-----+ +-----+
| ^ | |
| | | |
| | +---------+ | |
| | | with'ed |----------------------------------------->
| | +---------+ | |
| | | |
| Scope stack | |
| (innermost first) | |
| +----------------------------+
| Names table => | Id1 | | | | Id2 |
| +----------------------------+
|
| Name resolution must deal with several syntactic forms: simple names,
| qualified names, indexed names, and various forms of calls.
|
| Each identifier points to an entry in the names table. The resolution
| of a simple name consists in traversing the homonym chain, starting
| from the names table. If an entry is immediately visible, it is the one
| designated by the identifier. If only potentially use-visible entities
| are on the chain, we must verify that they do not hide each other. If
| the entity we find is overloadable, we collect all other overloadable
| entities on the chain as long as they are not hidden.
|
| To resolve expanded names, we must find the entity at the intersection
| of the entity chain for the scope (the prefix) and the homonym chain
| for the selector. In general, homonym chains will be much shorter than
| entity chains, so it is preferable to start from the names table as
| well. If the entity found is overloadable, we must collect all other
| interpretations that are defined in the scope denoted by the prefix.
|
| For records, protected types, and tasks, their local entities are
| removed from visibility chains on exit from the corresponding scope.
| From the outside, these entities are always accessed by selected
| notation, and the entity chain for the record type, protected type,
| etc. is traversed sequentially in order to find the designated entity.
|

Continue reading on narkive:
Loading...