P
P
palexisru2013-04-19 10:38:11
open source
palexisru, 2013-04-19 10:38:11

Compilers compilers with a modular language description?

Please suggest if readers are familiar with compiler versions of compilers in source that can be dragged into .NET (or onto the JVM), and which support modularization and allow parsing both imperative and functional languages.
The intended area of ​​use is the preparation of educational programming languages
​​Modular description of the syntax pl2-rainbow.livejournal.com/1090.html
Idea: in the examples that I met, the description of the calculator (arithmetic expression parser) is separate, other languages ​​are separate. At the same time, the arithmetic analyzer is a part of almost any language and can be placed in a plug-in module for describing the language.
In 1999, I did a language description that ran on TP YACC (Albert Graef), but the description had to be done in 15 files of four categories, which were merged with copy before being fed into yacc.
Cascading National Programming Languages ​​pl2-rainbow.livejournal.com/301.html
Idea: Possibility of consecutive translation from a national language into Russian, then into English, then translation into byte code (or machine code)
Basis: a program written in a national language can be checked a teacher in Russian according to the listing of the corresponding level.
For implementation, it is enough to use a compile-time dictionary - #define, placed in a separate specialized file indicating the contexts of the translated - namespace, class, method, method parameter.
The topic of national languages ​​was raised in the article habrahabr.ru/post/176243/
Assumed scopes and groups of operators for the generated language:
functional - Functional - for sections using functional programming.
aspect - Aspect - for interfaces and aspects. Methods can have the necessary properties and additions used before
predicate - Boolean - corresponds to Boolean variables, theorem proving, Aristotelian logic, working with SQL queries, LINQ or the simplest Prolog operations.
controller - Control - corresponds to the controller (Controller) of the MVC model
publish - Changeable - corresponds to the view (View) for the MVC model
public - Connecting - corresponds to the database model (Model) of the MVC model
protected - Protected - internal elements of the class
private - Internal - hidden elements of the class
local - Block - variables of methods and blocks
(from habrahabr.ru/post/176249/ - Abstraction and interaction model open systems)
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergei Borisov, 2013-04-19
@palexisru

If I understood correctly what you are talking about, then maybe pre-processing to lex/yacc will help you. Let's say m4.

P
palexisru, 2013-04-23
@palexisru

Thanks for the clarification.
I “in desire” have a self-unwinding compiler with a compiler of compilers translated into it.
In this case, the main type is an imperative language (close to C # and Java), but the functional part is assumed in the same syntax. Capture / release of memory - implicit, without pointers. If LL allows prefix decrement/increment processing, then it will suffice.
However, when I experimented with word wrapping in Russian, I found that the search for syllables goes better from right to left with the choice of the maximum chain of consonant groups from the list. Perhaps LR is more natural for the Russian language.
He also taught his son to learn poetry: The last line. Penultimate and last. Penultimate, penultimate and last…
I looked at the list of algorithms used in compilers and in functional programming (Field, P. Harrison Functional Programming: Translated from English - M .: Mir, 1993) - they suspiciously coincide. Maybe I'm wrong, but it's worth checking.
I don't want to touch F# in its pure form, unless it is needed for intermediate versions.
Perhaps it will be possible to make a compiler of compilers using only the programming language itself (with a different division compared to lex + yacc), without separating BNF into separate files (which can also ensure the modularity of the description)
I understand that it sounds worse than a scooter, but the main idea is to test the descriptive completeness of tunnel modeling as applied to programming languages. It may be possible to choose a subset of wrapper classes sufficient for learning languages ​​that will perform equally poorly on both .NET and the JVM.
Experience:
1991 - development in C of a utility that selected menu control commands from bat, and built a menu on the screen with a return of the selection through an errorlevel
1992 - development of a file describing the input field on Clipper - with the generation of an intermediate file - to speed up reading into memory
1992 - production in C from the Stroustrup calculator of a generator of settlement work (without arrays) with an XBase-like language. Recursive descent method.
1993 - libraries in C for use in Clipper
Further - mostly unfinished developments in the direction of the system:
class inheritance library in Clipper 5
wizards for Delphi
end-to-end system on the database meta description for Clipper, FoxPro 2, Delphi, PHP
description for a COBOL-like language translator with storing BNF description tables, keywords and variables in DBase files
For me, finite state machine transition tables are just what they ask for in relational databases. But I don’t want to get involved in the DBMS - apparently I will do with data files either XML or HTML. But if it works - what scope for optimization!
Thank you. Sincerely, Alex.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question