new language: programming that can speak to modern hardware easily

Submitted by olecom
on November 27, 2009 - 8:10am

Now i'm doing some kind of translator (to C), that can turn second to its functional equivalent -- first:

void handle_mcucsr(void) __attribute__((section(".init3"))) __attribute__((naked));
void handle_mcucsr(void)
{
    mcucsr = MCUCSR;
    MCUCSR = 0;
}

handle_mcucsr: sect[ion] .init3, naked!
	mcucsr = MCUCSR
	MCUCSR = 0

uint8_t handle_mcucsr(int8_t b, int16_t w, uint16_t ww) __attribute__((section(".init3"))) __attribute__((naked));
uint8_t handle_mcucsr(int8_t b, int16_t w, uint16_t ww)
{
    mcucsr = MCUCSR;
    MCUCSR = 0;
    return 0;
}

byte handle_mcucsr(byte -b, word -w ww): sect[ion] .init3, naked!
	mcucsr = MCUCSR
	MCUCSR = 0
	0.

Variables (in fact any memory data):
uint16_t ee_pwm __attribute__((section(".eeprom"))) = 42;
volatile uint16_t adcval;

word ee_pwm = 42: sect[ion] .eeprom[, mode..., C++, combined,....]
# == OR ==
word ee_pwm = 42:
	sect[ion] .eeprom
	mode...
	[C++, combined,....]
# '?' since compiler have no idea about what happens with this part of memory
word ?adcval

Special syntax and functionality:

слова	и=0 д=512
16бит	и=0 д=512 o='56'
байт	с = 0 а б='9' в г

Here's it, my doings against modern system of producing software. Cyntax is old and useless. Programming of the modern hardware requires modern, flexible, smart syntax. No errors in hardware logic, no problems with C f*cking etc. If somebody understands, then you are welcome to comment and do something to help to create modern programming tools.

В общем вот такой продукт, для того чтобы русскоговорящие дядьки-программеры железяк, которые никогда не въедут в бесполезный СИ, таки вырвались из плотных объятий ассемблера. Хочется создать современную, гибкую, умную систему для того, чтобы программирование было в кайф, априори без ошибок, сношений с СИ, непонятными сообщениями об ошибках СИ, а не ошибок задачи/железа и тд и тп.

Кто в теме, думаю понял. А кто понял, присоединяётесь!
____

AttachmentSize
OLEG-on-LED.jpg135.71 KB

more examples

on
November 29, 2009 - 3:16pm

can you give an example where your new syntax is more than C without braces and semicolons and with reordered attributes? how does it help with memory ordering? how does it interface with other programming languages?

LED indicator helper with #defines

on
December 4, 2009 - 5:56am

With some `sed` i have a table defining LED pins directly connected to the 8bit port transforming to some ugly C.

Input (with some description in russian)

  Светодиодный семисегментный индикатор
Подключение и программирование его контроллером
 ~   Данные обрабатываются кодировщиком программы,
[ ]  поэтому форму таблицы менять не надо.
 -   Менять можно ИЗОБРАЖЕНИЕ, имя и биты порта.
\_/. ВАЖНО: Порт должен быть один на все 8 бит!
рис.1

       Индикатор с прямым подключением
  (действие: _BV(PB#)|_BV(PB#) номерами PORTB)
                                    Таблица 1
  +---+--------------------+---+------------+
  |АНОД  ПАРАЛЛЕЛЬНЫЙ ПОРТ PORTB ИЗОБРАЖЕНИЕ|
  +---+--------------------+---+------------+
  | 1 |PPC0(2)             | 0 |     \      |
  | 2 |PPC1(3)             | 1 |     _      |
  | 3 |PPC2(4)             | 2 |     .      |
  | 4 |PPC3(5)             | 3 |     /      |
  | 5 |PPC4(6)             | 4 |     -      |
  | 7 |PPC5(7)             | 5 |     ]      |
  |11 |PPC6(8)             | 6 |     ~      |
  |10 |PPC7(9)             | 7 |     [      |
  +---+--------------------+---+------------+
  |КАТОД                   PORTD НОМЕР СЛЕВА|
  +---+--------------------+---+------------+
  | 6 |            (11)    | 0 |    4th     |
  | 8 |EPP_nDSTROBE(14)    | 1 |    3th     |
  | 9 |EPP_INTR    (10)    | 2 |    2th     |
  |12 |EPP_nASTROBE(17)    | 4 |    1th     |
  +---+--------------------+---+------------+
  |                (16)     PD3     клава   |
  +-----------------------------------------+

Arguments (source code snip.)

_0 = '[]~\/_'
_1 = ']/'
_2 = '~]-\_'
_3 = '~]-/_'
_H = '[]-\/'

Result (C output in this case)

#define _0 (_BV(PB7)|_BV(PB5)|_BV(PB6)|_BV(PB0)|_BV(PB3)|_BV(PB1))
#define _1 (_BV(PB5)|_BV(PB3))
#define _2 (_BV(PB6)|_BV(PB5)|_BV(PB4)|_BV(PB0)|_BV(PB1))
#define _3 (_BV(PB6)|_BV(PB5)|_BV(PB4)|_BV(PB3)|_BV(PB1))
#define _H (_BV(PB7)|_BV(PB5)|_BV(PB4)|_BV(PB0)|_BV(PB3))

Logic of direct connection: _BV(PB#)|_BV(PB#), where # is taken from the PORTB column.

Now i'm going to have a demultiplexer (3 to 8, to save uC pins) logic: if 3 bits are PB5..PB7, then value will be ((#1<<5) + (#2<<5)...) with # being same data.

defining OLEG

on
December 5, 2009 - 4:39am

fortunately on that very simple screening device i can write my name. O = 0 is there already, so

_L = '[\_'
_E = '[\~-_'
_G = '~_/\['

(see OLE-on-LED.jpg attached to the main article)

Nice post

on
December 14, 2009 - 1:25am

Technology keeps on changing every time. Cool post!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.