Categories: All - grammar - optimization - paradigm - semantics

by Shuai Wang 10 years ago

473

How to design a programming language

Developing a programming language involves multiple steps, starting with defining its grammar, which is essentially the syntax rules. Grammar analysis tools like YACC and parser combinators can help generate parse trees.

How to design a programming language

How to design a programming language

compiler implementation There DO exist some great compiler frontend, backend and library, so reinvent the wheel is lame...And it is even easier to use some VM as the running platform like JVM, CLI.

It is HELL when debuging and testing compiler
we'd rather be conservatism than aggrasive
Standard Library
Data Sturucture

Dictionary

Array

Set

Code Generation
Platform Dependent Optimization
Intermediate Code Generation change tree-style to linear-style if you use LLVM, JVM as backend, your job is done here
3-address
static single assignment form
Optimization
Platform Independent

copy propagation

common subexpression elimination

Especially for Functional language
Type Checking and Inferencing for static language
several inference algorithm

Hindley-Milner

Grammer Analyse u can get a parse tree from this analyse
Parser Combinator
YACC

grammer design Grammer is the so-called syntax

Syntactic Sugar
I love lisp.... who has NO grammer at all.
There can be SEVERAL grammers according to ONE sematics

semantic design

Flow Control
coroutine
continuation
build-in exception
Is non-structure jump allowed?
Sub Program
Is sub program allowed?

closure

lambda

Evaluation Strategy

The sequence of Evaluation

Lazy Evaluation

Eager Evaluation

Call Strategy

Is call by referance allowed?

Call by value

Call by name

First Class?

Storage
So-called Stackless Language
Scoping

Dynamic Scoping

Lexical Scoping

Is memory management by programmer allowed?
Is pointer allowed?
Programmer know the detail or not?
Programming Paradigm
some features

reflection

meta-programming

Both?
Declarative

Logical Language

Functional Language

Imperative
Type System
Sub-type
Type casting mechansim
Do we have type inference?

Is recusive type allowed?

Is subtype allowed?

Which formal system based on

Dynamic Type
Static Type
Strong Type
Weak Type