1
Онлайн компилятор Oberon-07/11
Путеводитель по Оберон-проектам.
Логи jabber-конференции.
Онлайн исходники BlackBox: тут:WeBB и на github
Исходники Project Oberon V4 на github.
Сборник решений задач книги "Современное программирование с нуля!" тут. А обсуждение здесь.
В этом разделе можно просмотреть все сообщения, сделанные этим пользователем.
let min_index a =
let min i m =
let m = if a.(i) < a.(m) then i else m in
if (Array.length a) = (i+1) then
m
else
min (i+1) m
in
min 0 0
Выходит, что твой кросскомпилер Оберон->C более эффективен, чем компилятор Блекбокса? Тебе надо срочно перевести Блекбокс на твой компилятор ))) Всё русское оберон-сообщество тебе огромное спасибо скажет. Правда, не заплатит ни копейки )))Ценю Ваш юмор.
Но если серьёзно, то, по-моему, лучше создать новую ОС-среду, полностью написанную сообществом и лишённую недостатков Блэкбокса.
#include <vector>
#include <iostream>
using namespace std;
struct bor
{
int mp[2];
int cnt;
bor(): mp({0,0}), cnt(0)
{}
};
vector<bor> tr;
int go()
{
tr.push_back(bor());
cerr << "go " << tr.size() << ' ' << tr.size() - 1 << endl;
return tr.size() - 1;
}
string s;
int add(int v, int i, int zn)
{
cerr << "in " << v << ' ' << tr.size() <<' ' << i <<' ' << s.size() << endl;
if (i == static_cast<int>(s.size()))
{
tr[v].cnt += zn;
return tr[v].cnt;
}
int x = s[i] - '0';
x = x % 2;
if (tr[v].mp[x] == 0)
{
cerr << "go in " << endl;
cerr << tr.size() <<' ' << tr[v].mp[x] << endl;
tr[v].mp[x] = go();
cerr << tr.size() <<' ' << tr[v].mp[x] << endl;
cerr << "go out " << endl;
}
return add(tr[v].mp[x], i + 1, zn);
}
int main()
{
go();
s = "01";
add(0, 0, 1);
}
5. С# является первым компонентно-ориентированным языком программирования.
--- old.txt 2016-05-01 14:25:17.925910136 +0200
+++ new.txt 2016-05-01 14:25:17.925910136 +0200
@@ -1,5 +1,5 @@
The Programming Language Oberon
- Revision 1.10.2013 / 4.3.2016
+ Revision 1.10.2013 / 1.5.2016
Niklaus Wirth
Make it as simple as possible, but not simpler. (A. Einstein)
@@ -26,7 +26,7 @@
to serve as a reference for programmers, implementors, and manual writers. What remains unsaid
is mostly left so intentionally, either because it is derivable from stated rules of the language, or
because it would unnecessarily restrict the freedom of implementors.
-This document describes the language defined in 1988/90 as revised in 2007/11.
+This document describes the language defined in 1988/90 as revised in 2007 / 2016.
2. Syntax
A language is an infinite set of sentences, namely the sentences well formed according to its
@@ -138,11 +138,10 @@
A data type determines the set of values which variables of that type may assume, and the
operators that are applicable. A type declaration is used to associate an identifier with a type. The
types define the structure of variables of this type and, by implication, the operators that are
-applicable to components. There are two different structures, namely arrays and records, with
+applicable to components. There are two different data structures, namely arrays and records, with
different component selectors.
- TypeDeclaration = identdef "=" StrucType.
- StrucType = ArrayType | RecordType | PointerType | ProcedureType.
- type = qualident | StrucType.
+ TypeDeclaration = identdef "=" type.
+ type = qualident | ArrayType | RecordType | PointerType | ProcedureType.
Examples:
Table = ARRAY N OF REAL
Tree = POINTER TO Node
@@ -387,9 +386,10 @@
hold:
1. The constant NIL can be assigned to variables of any pointer or procedure type.
2. Strings can be assigned to any array of characters, provided the number of characters in the
- string is not greater than that of the array. If it is less, a null character (0X) is appended. Single-
- character strings can also be assigned to variables of type CHAR.
+ string is less than that of the array. (A null character is appended). Single-character strings can
+ also be assigned to variables of type CHAR.
3. In the case of records, the type of the source must be an extension of the type of the destination.
+4. An open array may be assigned to an array of equal base type.
Examples of assignments (see examples in Ch. 7):
i := 0
p := i = j
@@ -718,7 +718,7 @@
ADC(m, n) INTEGER INTEGER add with carry C
SBC(m, n) INTEGER INTEGER subtract with carry C
UML(m, n) INTEGER INTEGER unsigned multiplication
- COND(n) INTEGER BOOLEAN IF Cond(8) THEN ...
+ COND(n) INTEGER BOOLEAN IF Cond(n) THEN ...
Proper procedures:
Name Argument types Function
@@ -743,9 +743,8 @@
string = """ {character} """ | digit {hexDigit} "X".
ConstDeclaration = identdef "=" ConstExpression.
ConstExpression = expression.
- TypeDeclaration = identdef "=" StrucType.
- StrucType = ArrayType | RecordType | PointerType | ProcedureType.
- type = qualident | StrucType.
+ TypeDeclaration = identdef "=" type.
+ type = qualident | ArrayType | RecordType | PointerType | ProcedureType.
ArrayType = ARRAY length {"," length} OF type.
length = ConstExpression.
RecordType = RECORD ["(" BaseType ")"] [FieldListSequence] END.
- Как провести грань между мелким скриптингом и приложением? Если можно, привести наглядные примеры.
- Расскажите что-нибудь из опыта отладки заковыристых мест при одновременной работе с OberonJS и JavaScript.
- Каковы преимущества использования OberonJS перед TypeScript касательно статической проверки типов.
- Каковы перспективы использования Asm.js?