Discuss Scratch

techygamemaker
Scratcher
61 posts

How could i start to make a programming language?

How could i start to make a programming language?
All Answers appreciated.

http://internetometer.com/image/46210.png
Hero OS is out now! View Here: Hero OS

techygamemaker
Scratcher
61 posts

How could i start to make a programming language?

Thanks! Just to ask , would i use NotePad ++ or anything like that to make it?

http://internetometer.com/image/46210.png
Hero OS is out now! View Here: Hero OS

techygamemaker
Scratcher
61 posts

How could i start to make a programming language?

Ah thanks for the help Its really helped me to know what to do now.

I guess I have to start Installing Ubuntu now, eh?

http://internetometer.com/image/46210.png
Hero OS is out now! View Here: Hero OS

gdpr533f604550b2f20900645890
Scratcher
1000+ posts

How could i start to make a programming language?

HI! I implemented a small C-style language in Scratch, so I know a little bit about programming language implementation. I'm no expert, but I'll tell you what I know.

The process of compiling a program is:
  1. Tokenize the program
  2. Parse the resulting lexemes
  3. Generate an intermediate representation of the program from the parse tree
  4. Optimize the code
  5. Generate the final machine-executable program

The tokenizer, or lexer, is a program that separates the program into lexemes, the different substrings with a lexical meaning. For example, the JavaScript code
var x = 0;
would be tokenized as
var
x
=
0
;
Next, the lexemes are parsed. My project uses the LR(1) parsing algorithm, a bottom-up (from parse tree leaves to root) shift-reduce parser. My project executes the program directly from the tree, but a more professional implementation would generate an intermediate representation. My project uses a stack to elegantly handle the instructions. For example, the parse tree
    +
/ \
5 *
/ \
2 7
would be executed as
PUSH 5     Stack: [5]
PUSH 2 Stack: [5, 2]
PUSH 7 Stack: [5, 2, 7]
MULTIPLY Stack: [5, 14 (AKA 7 * 2)]
ADD Stack: [19 (AKA 5 + 14)]

I hope my reply helps!
techygamemaker
Scratcher
61 posts

How could i start to make a programming language?

Thanks! i will be using all of your tips! Oh and the 8-bit thing confuses me lol.

http://internetometer.com/image/46210.png
Hero OS is out now! View Here: Hero OS

gdpr533f604550b2f20900645890
Scratcher
1000+ posts

How could i start to make a programming language?

Ihaveexpectations wrote:

techygamemaker wrote:

Thanks! Just to ask , would i use NotePad ++ or anything like that to make it?
It would be insanely hard to write it in Notepad ++ or something like that.

It would be insanely hard to write it in Windows.

Write it in GNU/LINUX, using the C programming language.


Compile using GCC.
Why not C++? I'm using that to make a parser.
kanishka_maiti
Scratcher
30 posts

How could i start to make a programming language?

Chibi-Matoran wrote:

HI! I implemented a small C-style language in Scratch, so I know a little bit about programming language implementation. I'm no expert, but I'll tell you what I know.

The process of compiling a program is:
  1. Tokenize the program
  2. Parse the resulting lexemes
  3. Generate an intermediate representation of the program from the parse tree
  4. Optimize the code
  5. Generate the final machine-executable program

The tokenizer, or lexer, is a program that separates the program into lexemes, the different substrings with a lexical meaning. For example, the JavaScript code
var x = 0;
would be tokenized as
var
x
=
0
;
Next, the lexemes are parsed. My project uses the LR(1) parsing algorithm, a bottom-up (from parse tree leaves to root) shift-reduce parser. My project executes the program directly from the tree, but a more professional implementation would generate an intermediate representation. My project uses a stack to elegantly handle the instructions. For example, the parse tree
    +
/ \
5 *
/ \
2 7
would be executed as
PUSH 5     Stack: [5]
PUSH 2 Stack: [5, 2]
PUSH 7 Stack: [5, 2, 7]
MULTIPLY Stack: [5, 14 (AKA 7 * 2)]
ADD Stack: [19 (AKA 5 + 14)]

I hope my reply helps!

link?

I EAT PIZZAS!
kanishka_maiti
Scratcher
30 posts

How could i start to make a programming language?

i made one on scratch
: https://scratch.mit.edu/projects/244381929/

I EAT PIZZAS!

Powered by DjangoBB