Make YOUR OWN Programming Language - EP 1 - Lexer

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ต.ค. 2024

ความคิดเห็น • 872

  • @finndotbin
    @finndotbin 3 ปีที่แล้ว +241

    Me: *blinks*
    Him: Now we are done let’s code the entire f-ing universe
    edit: dang this was a year ago when I didn't know how to code and now I feel bad for commenting this. Amazing video

    • @dittomario
      @dittomario 3 ปีที่แล้ว

      @Yousef GG! sdhgasuydgsduygaysudgyasdgyaudhahdyaghyiuasdgyasgy!!!!

    • @dominiktoser8531
      @dominiktoser8531 3 ปีที่แล้ว +2

      thats when you blink very slow

    • @dominiktoser8531
      @dominiktoser8531 3 ปีที่แล้ว +2

      @Yousef GG! LANGUAGE

    • @soupnoodles
      @soupnoodles 3 ปีที่แล้ว

      @@dominiktoser8531 dafaq

    • @nitro-ww6sk
      @nitro-ww6sk 3 ปีที่แล้ว

      He speaks quite fast, this causes some times different words to be pronoucned wrong. For example he means to say LEXER and i hear LECTURE or LETUCE.

  • @billclinton4913
    @billclinton4913 4 ปีที่แล้ว +1237

    Imagine running an interpreted language over an Interpreted language.

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว +177

      Haha yes

    • @pluscrafter7117
      @pluscrafter7117 4 ปีที่แล้ว +144

      Many compilers do that. I think it's called bootstraping and there is a python interpreter that is programmed in python (pypy).

    • @ramakanthrama8578
      @ramakanthrama8578 4 ปีที่แล้ว +13

      @@CodePulse Lol

    • @e.6z1
      @e.6z1 4 ปีที่แล้ว +6

      @@universenerdd YOU are dumb, Pluscrafter NEVER said Python was compiled and at least Pluscrafter knows the difference between their, they're and there

    • @universenerdd
      @universenerdd 4 ปีที่แล้ว +4

      @@e.6z1 okay, so what i meant was interpreters are not compilers, if you look at the original comment it makes sence, and i do know the difference, if that was what you were implying

  • @HT79
    @HT79 4 ปีที่แล้ว +39

    It took TH-cam 2 years to recommend this amazing tutorial....
    Really well done mate! It's inspired me enough to dabble on my own version.
    Not sure about an entire language but could be really useful for making CLIs.

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว +10

      Thanks! Yes definitely useful for CLIs, and also for parsing your own custom data file format.

    • @Markadown
      @Markadown 5 หลายเดือนก่อน

      And it took TH-cam 5 years to recommend it to me, lol.

    • @hamzacasdasdasd
      @hamzacasdasdasd 4 หลายเดือนก่อน

      @@Markadown me to

  • @albertlevins9191
    @albertlevins9191 2 ปีที่แล้ว +28

    Dude, thanks. You don't know me, but I am a solo game designer with a solid "B" in art skills, but a "C-" in programming. I have been trying to implement a basic like script interpreter in a python program I am making. Been trying for several years to get it right. This tutorial is EXACTLY what I needed. Thanks again.

  • @Drqonic
    @Drqonic 4 ปีที่แล้ว +161

    This is amazing to be honest. I've never seen anyone else code as cleanly as you.
    Do you think you could make a video on making a compiler next time?

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว +42

      Thanks! I do plan on doing that soon. The later episodes in this series have gotten more messy and complicated, and I'm planning on redoing this series first. I also am doing a simpler 4 part series on making a math interpreter before that. So hopefully I get around to doing a compiler soon :)

    • @Drqonic
      @Drqonic 4 ปีที่แล้ว +9

      @@CodePulse Thanks for the quick reply! I look forward to future videos :)

    • @sacredgeometry
      @sacredgeometry 2 ปีที่แล้ว +2

      This isn't cleanly written. There is lots room for abstraction here.

    • @10F2C
      @10F2C ปีที่แล้ว

      You mean compiler that actually writes machine code?

    • @Drqonic
      @Drqonic ปีที่แล้ว

      @@10F2C Completely forgot about this comment ngl. I meant down to assembly, similar to clang and GCC

  • @camclarke762
    @camclarke762 3 ปีที่แล้ว +9

    Great tutorial mate, but can we just take a moment to gaze in awe at this man's typing speed and code cleanliness like sheesh

  • @chandlercoates7637
    @chandlercoates7637 4 ปีที่แล้ว +202

    now create another language with that basic language you're creating

    • @dimitar.bogdanov
      @dimitar.bogdanov 3 ปีที่แล้ว +37

      Funnily enough, when you are able to do that, you can call your language Turing-complete (it can recreate itself, in itself), and is mostly a good-enough programming language for most basic tasks.

    • @hacklordmonster8780
      @hacklordmonster8780 3 ปีที่แล้ว +14

      Good luck with the speed of it

    • @0x1EGEN
      @0x1EGEN 3 ปีที่แล้ว +2

      @@dimitar.bogdanov You mean "self-hosting".

    • @dimitar.bogdanov
      @dimitar.bogdanov 3 ปีที่แล้ว +5

      ​@@0x1EGEN Your original reply:
      "You mean "self-hosting", turing complete just means it can theoretically compute anything. en.wikipedia.org/wiki/Self-hosting_(compilers)"
      An answer: no. A self-hosting compiler can compile itself, yes, but a language can be interpreted, and you could still make another language with it.
      Being Turing-complete means that it can simulate a Turing-machine. Taken from Wikipedia:
      "For example, an imperative language is Turing-complete if it has conditional branching (e.g., "if" and "goto" statements, or a "branch if zero" instruction; see one-instruction set computer) and the ability to change an arbitrary amount of memory (e.g., the ability to maintain an arbitrary number of data items)."
      That means, that as long as you have if statements and some way to loop (be it goto statements or a for loop), your language is turning complete.

    • @elliotk9291
      @elliotk9291 3 ปีที่แล้ว

      I'm actually doing that right now

  • @svecs132
    @svecs132 3 ปีที่แล้ว +36

    4:40 i don't understand much of the code, but i just like the smooth self line
    self
    self
    self
    self

  • @MirrorsEdgeGamer01
    @MirrorsEdgeGamer01 5 ปีที่แล้ว +75

    Why did you make an *_as_string_* method not just use the built in Python's *___str___* method?

    • @CodePulse
      @CodePulse  5 ปีที่แล้ว +44

      I hadn't really used Python much in ages so never though of it then. I realized a while later but never bothered to change it.

    • @jaysonlana9147
      @jaysonlana9147 3 ปีที่แล้ว +1

      @@CodePulse sorry im new to python and i recieve ths error but i dont have str in my code
      AttributeError: 'str' object has no attribute 'fn'

    • @anshbarhate2791
      @anshbarhate2791 3 ปีที่แล้ว

      @@jaysonlana9147 If you still have that issue, it means somewhere you've typed self.fn instead of ln. Probably in def copy()

    • @thelavagod
      @thelavagod 2 หลายเดือนก่อน

      ​@@anshbarhate2791the comment was 3 years ago

  • @silkcut5561
    @silkcut5561 5 ปีที่แล้ว +7

    Awesome! Thanks to all channels which shows this topic. I always wondered how this works :) Thanks to all!

  • @universenerdd
    @universenerdd 4 ปีที่แล้ว +20

    finally, a version of BASIC that is actually basic

    • @yaman09
      @yaman09 ปีที่แล้ว

      how help please

  • @holomode1357
    @holomode1357 4 ปีที่แล้ว +67

    "We can multiply numbers": 1 + 2
    Python default calculation: 1 + 2

    • @mikethegamedev
      @mikethegamedev 3 ปีที่แล้ว +9

      1 + 2 = 6

    • @mikethegamedev
      @mikethegamedev 3 ปีที่แล้ว +6

      SIKE its 3

    • @mrwasserflasche6063
      @mrwasserflasche6063 3 ปีที่แล้ว +1

      @@mikethegamedev no it's 69,420

    • @aw1lt
      @aw1lt 3 ปีที่แล้ว +1

      @@mikethegamedev damn bro I nearly did my homework wrong because u said it was 6

    • @TacticalAllRounder
      @TacticalAllRounder 3 ปีที่แล้ว

      @@aw1lt ...

  • @shouryshinde4145
    @shouryshinde4145 3 ปีที่แล้ว +56

    10:35: "generates all the tokens correctly..."
    Me: *runs program*
    output: [ ]

    • @hasanekmen7873
      @hasanekmen7873 3 ปีที่แล้ว +5

      Input : 9 * 9
      Output :
      Input : d
      Output : Illagel Char : d
      Input : d * 9
      Output :

    • @gamingforever65
      @gamingforever65 8 หลายเดือนก่อน +1

      I have the same problem is there any fix

    • @LavenderCat175
      @LavenderCat175 7 หลายเดือนก่อน +1

      @@gamingforever65 Yes please encountering the same issues

    • @nathanaelchia7167
      @nathanaelchia7167 5 หลายเดือนก่อน

      It should be at the tokens list, the [] should have a space in between

    • @abeethayuka
      @abeethayuka หลายเดือนก่อน

      how do i fix this issue?

  • @logangraham2956
    @logangraham2956 3 ปีที่แล้ว +4

    oh your lexer is so nice . it actually handles problems.
    my lexer just advances over them .
    so once/if mine ever becomes a compiler instead of a interpreter.
    literally everything will compile but whether or not it will run is another story entirely.

  • @arthur_p_dent4282
    @arthur_p_dent4282 2 ปีที่แล้ว +10

    This is great. Been working my way through Nand 2 Tetris on my own. I made it through the hardware portion all right but once it got to writing the assembler I felt completely lost. Hoping this will give me the nudge I need, so far I'm loving the content and can't wait to finish.

    • @thatpenguin965
      @thatpenguin965 ปีที่แล้ว

      Nice, my brother is doing that too

  • @Markkkkkkkkkkkkkkkkk
    @Markkkkkkkkkkkkkkkkk 4 ปีที่แล้ว +79

    Nice. I'm 15 and thinking of creating one in the future.
    I might name it : Pascala
    Pascala's name is derived from Pascal + Scala

    • @bmax5928
      @bmax5928 4 ปีที่แล้ว +6

      ill take that m8

    • @dimitar.bogdanov
      @dimitar.bogdanov 3 ปีที่แล้ว +28

      Don't share your project names with strangers until you've created something. Bad, bad idea

    • @MrDgf97
      @MrDgf97 3 ปีที่แล้ว +4

      I’m always so envious of seeing young people with that drive. When I was 15 all I cared about was playing videogames and being cool, such useless things

    • @danielshah3494
      @danielshah3494 3 ปีที่แล้ว

      Sounds gay af tbh

    • @martilix4470
      @martilix4470 3 ปีที่แล้ว +2

      @@dimitar.bogdanov thats the stupidest thing I’ve ever heard. The name, or even the idea don’t matter, the execution does

  • @cannedsoup4622
    @cannedsoup4622 2 ปีที่แล้ว +10

    I thought that the output of "1.2+1" would be "float: 1.2 | plus | int: 1", however I've noticed that it skips the plus sign entirely.
    It does that for every first character behind a number. I checked my code (I translated your code into lua and thought I messed something up) and then was suprised to see that indeed, it skips the first character that comes after any number in the make_number function.
    There is an easy fix to it tho! After the loop in the make_number function you need to decrement the self.pos by 1. (self.pos -= 1) After doing that it now correctfully translate the input "1.2+1" to "float: 1.2 | plus | int:1" instead of the output given above.
    I do not know if the same issue has happened to anyone else before, but if it did it would be nice if you could pin this message, it was not as easy to track down as it might sound from above.
    Nice video nontheless! It helped me out a lot!

    • @UnladenSwallow227
      @UnladenSwallow227 2 ปีที่แล้ว +1

      Are you sure you didn't call self.advance() in the while loop of make_tokens() as well, after tokens.append(self.make_number())? That would result in calling self.advance() twice, which creates the issue you ran into. I have the code in the video and I was not able to reproduce your issue at all.

    • @NA-jy4zd
      @NA-jy4zd 2 ปีที่แล้ว +1

      The problem is just you. There is something wrong with your code. You can copy the ep1 code from github to confirm that you did everything correctly.

  • @CyberCoder
    @CyberCoder 3 ปีที่แล้ว +2

    I've got like 3 yrs of experience in C#, but only like 3 months in Python. Probably not this I should do with only 3 months of exp. but I strongly believe that my C# skills will help. Amazing tutorial ngl

  • @sakul_the_one4821
    @sakul_the_one4821 3 ปีที่แล้ว +4

    Really thx for this Toutorial! This was my first Toutorial that I used for Python ( If I don’t mention the Python Code in my Java File and 8 Videos of Python but I didn’t test them...) So I learned here not just how to make a programming language, I learned even Python with this Toutorial! Really thx for it!

  • @deckermv7530
    @deckermv7530 2 ปีที่แล้ว +3

    Absolutely great job for a talented mad man like you. Looks like this series is gonna be sick. Thanks for sharing this! Gonna learn a lot from this

  • @Jerraf2p0
    @Jerraf2p0 ปีที่แล้ว +11

    I can’t believe this dude wrote a full lexer without any modules. Great job

  • @sourishsharma5745
    @sourishsharma5745 3 ปีที่แล้ว +8

    This channel is underrated...

  • @MrKoshak3
    @MrKoshak3 5 ปีที่แล้ว +4

    You're just a god, I barely understand English, but I understand you more than compatriots

    • @CodePulse
      @CodePulse  5 ปีที่แล้ว

      That's great to hear! Thanks

  • @thinkmovies4565
    @thinkmovies4565 5 ปีที่แล้ว +6

    Awesome, I know have a fully working lexer and I am working on a programming language known as jublee. Which already has the basic features of addition , sub , mul and div.

    • @fenderat1713
      @fenderat1713 5 ปีที่แล้ว

      link it and ill try it out anbd give my own feedback

  • @Apoorvpandey
    @Apoorvpandey 2 ปีที่แล้ว +1

    The error output looks so neat!
    Copilot suggested me how to get output like this:
    calc> 12+23.3+g
    Illegal Character: g
    File , line 1
    12+23.3+g
    ^
    Error representation should be:
    result = f'{self.name}: {self.details}'
    result += f'
    File {self.pos_start.filename}, line {self.pos_start.ln + 1}'
    line = self.pos_start.filetext[:self.pos_start.col+1]
    result += f'
    {line}'
    result += '
    ' + ' ' * (self.pos_start.col) + '^'
    return result

  • @justcallmenoah5743
    @justcallmenoah5743 3 ปีที่แล้ว +1

    Bro you are a genius! I came for the custom OS project but I'm gonna have to watch your entire back catalogue!

    • @CodePulse
      @CodePulse  3 ปีที่แล้ว

      Thanks! Hope this series is as good as my operating system one.

    • @justcallmenoah5743
      @justcallmenoah5743 3 ปีที่แล้ว

      @@CodePulse im excited to finish this one quickly, and excited to see where the operating system goes!

  • @Dorsz12303
    @Dorsz12303 4 หลายเดือนก่อน

    I always wanted to make my own programming language. And I find perfect tutorial from 2018. Thank you!

  • @nathanellis7819
    @nathanellis7819 5 ปีที่แล้ว +19

    THIS WAS EXCELLENT! WELL DONE MATE!!

  • @parkeranderson23
    @parkeranderson23 4 ปีที่แล้ว +5

    wow this is genuinely quality content 10/10

  • @ga_per
    @ga_per 3 ปีที่แล้ว +9

    WTF youtube's algorithm is already in 2080, I was thinking about creating a language yesterday and now I get this in my recommended

    • @kilogram9559
      @kilogram9559 3 ปีที่แล้ว +1

      same

    • @TheSpekeyMan
      @TheSpekeyMan 3 ปีที่แล้ว

      Google hears ur stuff or wut ever ur saying

  • @abheygupta2332
    @abheygupta2332 3 ปีที่แล้ว +13

    We are making a programming language with python which is an easy language
    just imagine how the first programming would have been created

    • @supersani21
      @supersani21 3 ปีที่แล้ว +4

      Well we do use C++ for Python which derives itself from assembly languages which derives itself from machine language

    • @kartikeykushwaha3622
      @kartikeykushwaha3622 3 ปีที่แล้ว +4

      @@supersani21 I think python's written in C.

    • @GDPlainA
      @GDPlainA 3 ปีที่แล้ว

      @@kartikeykushwaha3622 C++ can run C code btw so its not really a big difference.

    • @mcds6307
      @mcds6307 2 ปีที่แล้ว +2

      @@GDPlainA It is. C++ is not C.

    • @engelsteinberg593
      @engelsteinberg593 2 ปีที่แล้ว

      Assembly, and assembly was created with hex. Altrogut assembly is easy created.

  • @ScienceCodeCreations
    @ScienceCodeCreations 10 หลายเดือนก่อน +1

    Good tutorial! I tried this once before when I was still pretty new at python and I didn't understand it so I gave up after the first two vids. But, now that I'm more familiar with the syntax of python, I can actually understand everything in this tutorial.

    • @CodePulse
      @CodePulse  3 หลายเดือนก่อน

      That's awesome to hear!

  • @therandomguy1701
    @therandomguy1701 3 ปีที่แล้ว +2

    Finally, my next project to test my 1 month of programming experience!

  • @ouioui2793
    @ouioui2793 4 ปีที่แล้ว +16

    Im creating a language called Neptune, 'cuz it is my favorite planet. I want to make it the most easy to understand programming language using a lot of simple keywords

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว +2

      Good luck with it!

    • @ahmedzarin2247
      @ahmedzarin2247 3 ปีที่แล้ว

      @MoolsDogTwo hey me too!

    • @Tashmimanam
      @Tashmimanam 2 หลายเดือนก่อน

      Make sure to make it beautiful bcuz Neptune is a beautiful planet 😁👍

  • @rodrigopennacchi2451
    @rodrigopennacchi2451 9 หลายเดือนก่อน

    Thank you for sharing this very clear and usefull material! it is amazing, congratilations!

  • @greasymushroom112
    @greasymushroom112 3 ปีที่แล้ว +5

    I’m making a language called quil (yes I know there is only one “L”) this helped a lot

    • @mavdotj
      @mavdotj 3 ปีที่แล้ว

      What a coincidence (look at my name)

  • @kavyaagrawal2013
    @kavyaagrawal2013 3 ปีที่แล้ว +4

    Thank you so much for this tutorial! Very well explained ;)
    I'll try making one in javascript!
    Thanks again!

  • @MrRyanroberson1
    @MrRyanroberson1 3 ปีที่แล้ว +1

    7:11 really really important flaw: the while loop will keep appending same char to the string indefinitely once it starts. there's nothing to advance it. ok you caught this at 10:31, this took me a couple watches to see if you put that somewhere in the video

  • @jonoisedev
    @jonoisedev 3 ปีที่แล้ว

    Oh, man! I could watch this all day long.

  • @somethingwithtech
    @somethingwithtech 3 ปีที่แล้ว

    i ran into a problem while coding and i literally searched for 45min befor i realised that i miss spelled a variable.
    Btw great Video thanks ;)

  • @perinoveriza1658
    @perinoveriza1658 5 ปีที่แล้ว +4

    Im enjoy with your video...great teaching 👍👍👍❤️❤️

    • @CodePulse
      @CodePulse  5 ปีที่แล้ว +3

      Thank you :)

  • @lasannishshanka4850
    @lasannishshanka4850 4 ปีที่แล้ว +1

    Sorry CodePulse, I have some questions.. :)
    1. Python is a language that is a bit slow compared to other lnguages. So can another language created using python be faster than Python ?
    2. Does this tutorial series include everything in BASIC Language ?
    3. What are the basics of the Programmig Language ?
    Many thanks to the tutorials you created ^)

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว +3

      1. A language created in Python can be faster if (a) it is compiled to machine code, or (b) it is compiled to byte-code to be interpreted by some other application such as JVM (Java virtual machine), or WASM (WebAssembly to allow it to run on the web).
      2. No, as the series progresses the language differs more from the basic language.
      3. I'm not sure what you are asking here.
      Your welcome :)

  • @creepersaur
    @creepersaur 2 ปีที่แล้ว +2

    I think I got something wrong. I followed the tutorial, but what happens when I do 1 + 1 is strange.
    basic > 1 + 1
    [, , ]
    NEVERMIND I forgot to put __ after __repr

  • @unh0lys0da16
    @unh0lys0da16 4 ปีที่แล้ว +1

    To speed things up you might want to set self.length to len(text) in __init__, else you change the complexity of advance to O(n) where n is the length of the text.

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว

      Are you saying the Python `len` function is O(n)?

    • @unh0lys0da16
      @unh0lys0da16 4 ปีที่แล้ว +1

      @@CodePulse aaah I've done some tests and it seems to be O(1), apparantly Python builtins (Dict, Lists etc) keep track of the size internally.

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว

      @@unh0lys0da16 Makes sense, that's what I assumed. Different from C's strlen function which is O(n)

  • @kanuos
    @kanuos 2 ปีที่แล้ว

    Thank you so much for making this. Subscribed!

  • @andreweathan
    @andreweathan 4 ปีที่แล้ว +5

    thanks for the tutorial, you have good programming skills

  • @Dustymarker9489
    @Dustymarker9489 9 หลายเดือนก่อน +1

    When I put a space in between my numbers it errors how do I fix that, I looked back through the video and couldnt find anything I did wrong so please help.

    • @Dustymarker9489
      @Dustymarker9489 9 หลายเดือนก่อน

      Never midn I fixed it by adding it to the character list under Lexer and doesnt seem to have broken anything and works fine

  • @emilsayahi1
    @emilsayahi1 4 ปีที่แล้ว +2

    You're fairly damn good at explaining things.

  • @just_kidding_kid
    @just_kidding_kid 4 ปีที่แล้ว +2

    Much much thanks for your videos! It helped me a lot while other tutorials and series did not

  • @miniappletheapple
    @miniappletheapple 3 ปีที่แล้ว

    a year ago i wanted to create a programming language but i don't even know what is class in python,but now i can code in rust,understanding OOP and little bit of data structure and algorithm

  • @vladusa
    @vladusa 2 ปีที่แล้ว +1

    This video reminds me that there is always a better programmer out there.

  • @yeahuh4128
    @yeahuh4128 4 ปีที่แล้ว +5

    I've been working on the class Error so long, now I can't pronounce the word 'error'

  • @mohammad4388
    @mohammad4388 4 ปีที่แล้ว +1

    I don't get the part of where it states whether the no. is a integer or not

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว

      If the number of dots/decimal points in the number is 0, then it can be an integer, otherwise it needs to be a float.

  • @DragoniteBrian
    @DragoniteBrian 3 ปีที่แล้ว +1

    random quesion:what does self mean and why did you use it

  • @Bl0xxy
    @Bl0xxy 10 หลายเดือนก่อน

    I personally would've used enums for the token system, I'll just try to follow along with those, hope it isn't too much of a struggle (I'm using C++, and yes I know python doesn't have them builtin but there is a builtin lib for that)

  • @oldmovies3776
    @oldmovies3776 10 หลายเดือนก่อน +1

    How does the computer know what is basic

  • @danielmunch2219
    @danielmunch2219 5 ปีที่แล้ว +28

    Nice video. But please just don't copy the same thing HowCode does...

    • @CodePulse
      @CodePulse  5 ปีที่แล้ว +21

      Thanks. My aim for this series is to improve on HowCode's tutorials, as his original series didn't use proper techniques, and he rushed his newer series in my opinion. I also plan on making the series much longer and add a lot more features that are missing from HowCode's tutorials (for example functions with arguments).

    • @danielmunch2219
      @danielmunch2219 5 ปีที่แล้ว +3

      Okay. That's fine. I thought you did it because you didn't know what to do. But cool.

    • @CodePulse
      @CodePulse  5 ปีที่แล้ว +1

      @Najmul hossain As in the minimax algorithm in game theory? It's not really the type of thing that I had planned for the channel, and there seems to be plenty of explanations out there already. But if enough people wanted it, I would definitely consider it.

    • @beautifulmind684
      @beautifulmind684 4 ปีที่แล้ว

      The author @you at the final episode! @@

    • @jonathanvanderwal7265
      @jonathanvanderwal7265 4 ปีที่แล้ว

      what is the commmand

  • @bigbabby1232
    @bigbabby1232 4 ปีที่แล้ว +1

    how did you get it so that when you click new terminal it says just terminal> and not the path to the folder you are working in?
    Also I copied everything from github and type in the terminal 'python3 shell.py' nothing happens!
    Edit: I have the Python extention for VScode in version 2018.3.0

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว +1

      On windows you can use the "prompt" command to change what text shows up.
      If you are using windows 10, it preinstalls a python3 program, but this isn't the real python, rather a link to the microsoft store to install python. This could be why nothing happens. Try just run "python" instead of "python3", otherwise you may have to update your path.

    • @bigbabby1232
      @bigbabby1232 4 ปีที่แล้ว

      @@CodePulse thanks, just changing pythin3 to python sorted it. (:

  • @jesnilinke5016
    @jesnilinke5016 3 ปีที่แล้ว +2

    If I did this in a different Programming language, do I follow these steps or should I translate it?

    • @reinhold1616
      @reinhold1616 2 ปีที่แล้ว

      well you cant run python in an interpreter/compiler that is not for python ;)

  • @minyakonga8897
    @minyakonga8897 2 ปีที่แล้ว

    A lexer is responsable turn source code into tokens, these tokens are identifiers, keywords, operators, delimiters and literals.

  • @ajithkumarnair7542
    @ajithkumarnair7542 3 ปีที่แล้ว +1

    Please help me, it is showing that module basic has no attribute run, if i try to use 'from basic import run' ,it shows cannot import run from basic

  • @elquelobetodo
    @elquelobetodo 4 ปีที่แล้ว +7

    my teacher let me make an a compilator for my exam, i want to see his face when he try to prove the nekolenguage

  • @hartsaxena371
    @hartsaxena371 4 ปีที่แล้ว +1

    This is... actually really good.

  • @SophiaWoessner
    @SophiaWoessner ปีที่แล้ว

    This man types at the speed of sound, I havent even finished typing class Token: and the video is already over like holy fuck

  • @freebiman8268
    @freebiman8268 2 ปีที่แล้ว

    Thank you I enjoyed this I always wanted to do something like this

  • @inserteunnombreapropiado9079
    @inserteunnombreapropiado9079 3 ปีที่แล้ว +2

    Now try to make one with assembly.

  • @dugtheartofbeingone2425
    @dugtheartofbeingone2425 3 ปีที่แล้ว

    Seems like the easiest language to understand out of the few I've seen! How did you come across it?

  • @karanvenkatesh8004
    @karanvenkatesh8004 5 ปีที่แล้ว +2

    wait i have a doubt how do you index the line ???
    like the how do you make python show the line in which your typing!!!

    • @CodePulse
      @CodePulse  5 ปีที่แล้ว +1

      Are you talking about the line number @ 15:28? If so, this isn't actually getting the line number in the terminal, it's always line 1.

  • @muzafferckay2609
    @muzafferckay2609 3 ปีที่แล้ว +1

    You dont have to type tons of 'elif' use a dict to map symbol to its value

  • @ihorandreienko9648
    @ihorandreienko9648 4 ปีที่แล้ว +4

    you're amazing!! Great tutorial

  • @wolfieboy09
    @wolfieboy09 ปีที่แล้ว +1

    I know this video is 4 years old, I will just say that you don't have to do
    "'" + char + "'"
    instead, you can do f"'{char}'"

  • @RadiantCorium
    @RadiantCorium 3 ปีที่แล้ว +1

    when i try to use floats, it says "Illegal Character: '.'"

    • @CodePulse
      @CodePulse  3 ปีที่แล้ว +1

      You probably have a mistake in your code

    • @hotdog9259
      @hotdog9259 3 ปีที่แล้ว

      Did you get it fixed? I have the same issue.

  • @it1shka
    @it1shka 5 ปีที่แล้ว

    seems difficult but i want to get into it ;) for the first time watching i just rewrite your code. When you began to improve Error class my brains just broke. I think i will watch this vid till I understand it enough good.
    At all, good tutorials, one of the best ive found. Unfortunately, in Russian programming segment there is no tutors how to create your own compiler/interpreter. But it seems like i found an amazing one in English
    sorry for broken English

    • @CodePulse
      @CodePulse  5 ปีที่แล้ว

      Thank's for your comment! Your English is not bad. I think I overcomplicated this series, and I intend to simply things in my future tutorials :) Good luck!

  • @Teog1992
    @Teog1992 4 ปีที่แล้ว

    great video . I wanted to ask :
    1. Should keywords like *if* , *for* , *function* are implemented at this stage , I mean in the lexer?
    2.Do we also implement a comment elimination strategy , like we do with spaces , in this phase?

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว +1

      1. It's up to you, I prefer to do it in the lexer as seen in one of my later tutorials.
      2. Yes that sounds right

  • @learnforbest-4500
    @learnforbest-4500 4 ปีที่แล้ว +2

    thanks for your tutorial @CodePulse sir

  • @thelavagod
    @thelavagod 3 ปีที่แล้ว

    i have a problem, everytime i run my code and put an illegal character it says "Illegal Character: '&'File , line 1" without any space

  • @pikleman5880
    @pikleman5880 4 ปีที่แล้ว +1

    The code does not work, whenever I run it, I enter the expression into the prompt and then the prompt keeps staying the same, like if you hit enter, nothing happens, all the cursor does is go down one line

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว

      Not sure why that might be happening but you can compare your code to mine here: github.com/davidcallanan/py-myopl-code

    • @pikleman5880
      @pikleman5880 4 ปีที่แล้ว

      @@CodePulse Thank you

    • @pikleman5880
      @pikleman5880 4 ปีที่แล้ว

      @@CodePulse Also, Do you know how I could add more builtin fuctions, like a generic way to do so

  • @i_wear_skin
    @i_wear_skin ปีที่แล้ว

    I have a question. Could you make a tutorial on one more advanced or use C++?

  • @keyl308
    @keyl308 2 ปีที่แล้ว

    I dont really understand why you used a while loop for the lexer. A for-loop would have made it much easier, because you wouldnt need the advance()-function, cleaning up the code. Additionally it would have made the code execution much faster, which is an important factor if you write an intepreted language inside of an intepreted language

    • @jimmlmao
      @jimmlmao ปีที่แล้ว

      While loops are faster than for loops

  • @skaruts
    @skaruts 3 ปีที่แล้ว

    By the way, you should be able to run a python script by just typing the filename (no extension needed). Just type in "shell" and hit enter. It works on my end, at least (windows 7).

    • @angelcaru
      @angelcaru 3 ปีที่แล้ว

      If he did that, viewers following along on Linux would suffer

    • @skaruts
      @skaruts 3 ปีที่แล้ว

      @@angelcaru it doesn't work on linux?

    • @reinhold1616
      @reinhold1616 2 ปีที่แล้ว

      @@skaruts it does if you make it executable and put #!/usr/bin/python3 on the first line

  • @cremeeggstudios
    @cremeeggstudios 2 ปีที่แล้ว

    Can you explain how you suddenly added attributes to the lever class

  • @Cowboy8625
    @Cowboy8625 5 ปีที่แล้ว +5

    Dude! Great video!!!!

    • @CodePulse
      @CodePulse  5 ปีที่แล้ว +1

      Thanks

    • @Cowboy8625
      @Cowboy8625 5 ปีที่แล้ว +2

      CodePulse yeah man! You write some super clean code! I’m trying to make my own language just for fun and wow this has help a lot. It’s really really fun to! Keep it up man!!

  • @umplayerbr1481
    @umplayerbr1481 ปีที่แล้ว +1

    hello bro! awesome tutorial! im getting an error, the final part, when you make the file and line error, when i start the py file it shows first: "Illegal Character: '&' ", then shows the shell, and the file and line error doesnt works. I dont know if youre gonna see this, but i wish you see, bc i always wanted to make my own program lang. thx for the awesome tutorial

    • @reversecascade8152
      @reversecascade8152 ปีที่แล้ว

      Im having this same issue. Did you ever figure it out?

    • @umplayerbr1481
      @umplayerbr1481 ปีที่แล้ว

      @@reversecascade8152 nope

    • @reversecascade8152
      @reversecascade8152 ปีที่แล้ว

      @@umplayerbr1481 I restarted VS Code which might've fixed it but I tried some other things so it could have been one of those

    • @umplayerbr1481
      @umplayerbr1481 ปีที่แล้ว

      @@reversecascade8152 can you tell me what things you did?

    • @umplayerbr1481
      @umplayerbr1481 ปีที่แล้ว

      i already tried restarting VS Code

  • @r50142
    @r50142 4 ปีที่แล้ว +1

    Hey i wanna make another programming language named Globe, how do i add custom built-in functions again?

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว

      th-cam.com/video/1k_N0oUOpjY/w-d-xo.html

  • @ZgavY
    @ZgavY 3 ปีที่แล้ว

    zgavY will be the best! Can't wait to code in zgavY

    • @ZgavY
      @ZgavY 3 ปีที่แล้ว

      @FichDich InDemArsch yep. The syntax is very cringe as well..

  • @BukhariTechnologies
    @BukhariTechnologies 2 ปีที่แล้ว

    I wrote it in C#. Where can I send you so you may review it?

  • @gign_9891
    @gign_9891 2 ปีที่แล้ว

    if i knew how to make a programming language, I would call it OceanCode and code for making text with another font like hello world is
    anyways my favorite font is indeed consolas

  • @10xyzYT
    @10xyzYT 2 ปีที่แล้ว +1

    Friend, in the input, it says runtime error lost sys.stdin
    How to fix?

    • @10xyzYT
      @10xyzYT 2 ปีที่แล้ว +1

      @CodePulse

  • @spencergates1786
    @spencergates1786 3 ปีที่แล้ว +2

    i get the error 'import nide' (nide is my language) at the start of the shell file.... no idea why. I even checked the github and it all was the same, im using python 3.9
    can anyone help please!
    edit: i also tried renaming everything to what he used and same result

    • @slimestaff1
      @slimestaff1 2 หลายเดือนก่อน

      Are they in the same file folder?
      Yeah, I know kinda late

  • @PrivateSi
    @PrivateSi 3 ปีที่แล้ว

    I would prefer a language that is as non-verbose as possible, ideally with no reserved words but with standard class libraries, with as little syntactic candy as possible. The best way to do this is start each block with a symbol indicating block type, followed by a single line block header or entire short block. NO BLOCK END MARKERS... Instead use tab sequences (enforced by a strict editor, perhaps with the entire program as a treeview control) to indicate block depth...
    memo1 : UI.Memo {textbox control - only one form of comments allowed, NESTED COMMENTS! so this close bracket is required}
    * 10 {Loop 10x}
    memo1+=``Hello World`` {adds another Hello World. Grav `, apostrophe ' or quotes " indicate text start, next instance closes, double = new line after text}
    list1 : UI.List {ListBox control}
    * 0..10 {Loop 0 to 10.. * n=0..10 if you need a loop counter}
    list1+='Hello World' {adds another Hello World list item, += is overloaded to mean 'append list with new item'}
    list1 : UI.List; * 10; list+="Hello World" {short blocks can be on one line separated by semicolons but cannot contain SUB BLOCKS!}
    There is no better language paradigm in terms of pro programming speed, potential power and compiler efficiency in perfect balance without hogging reserved words.
    .`some text` could mean console output. `text` variable `text` should automatically convert variable to text. All types have a text output function, else #ERROR# is displayed
    * 10; .``Hello World`` {SWEET!}
    * n=1..10; .`Hello World ` n ```` {if a string ends with a variable followed by a new line it's a bit messy, else it's a pretty clean system}
    now let's dirty it with some markup..
    * n=1..50++5; .~n`Hello World`~b~i~$00ff00~fill($000000) n```` {step n by 5... normal text then bold, italic, green ink, black background number}
    * n=1..10**5; .~n`Hello World`~b~i~$00ff00~fill:$000000 n```` {step n * 5... : param1, param2, ... vs (param1, param2, ...)
    * n=1..50//5; .~n`Hello World`~b~i~$00ff00~fill:$000000 n```` {step n * 50/5=10... : param1, param2, ... vs (param1, param2, ...)
    now let's sort out all those bloated HTML tags.... and become ~text and ~TEXT.
    ~p~p`Here's some text`~P~P {the end tags could also still be left off, as in HTML}
    NO RESERVED WORDS (but standard libraries), NO CODE BLOCK PARENTHESES (only single line blocks or indented blocks, preferably in a treeview control).

  • @fashidox
    @fashidox 4 ปีที่แล้ว

    I have researched into this stuff before and now I'm finally doing it, thanks to your channel. One question though, how come you don't get errors that are apparent in mine? Like for example, the lines saying "tokens.append(Token(MUL))" etc. every single one of them tells me I haven't passed a value.

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว

      You might be missing the default value in the Token class, make sure in the `__init__` method it has `value=None`.

  • @bronzebyte5801
    @bronzebyte5801 4 ปีที่แล้ว

    Dude... This is amazing! I have tests coming up but I'm creating my own coding language called Kozo! :D

    • @bronzebyte5801
      @bronzebyte5801 4 ปีที่แล้ว

      I have a question. How do I import basic? I get the error - Traceback (most recent call last):
      File "main.py", line 5, in
      result, error=basic.run(text)
      NameError: name 'basic' is not defined

    • @bronzebyte5801
      @bronzebyte5801 4 ปีที่แล้ว

      nvm i got it to work

    • @bronzebyte5801
      @bronzebyte5801 4 ปีที่แล้ว

      and it isnt working again... pls help! i even copied the code from github but it isnt working

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว

      Are both files definitely in the same folder?

    • @bronzebyte5801
      @bronzebyte5801 4 ปีที่แล้ว

      @@CodePulse yas they were... but i got it to work. i had renamed the file to hellothere.py.... I use repl.it so i got some help. they told me to rename it to basic.py and it magically worked lol. :D

  • @PDsChannel0112
    @PDsChannel0112 2 ปีที่แล้ว +1

    What does it mean by "lexer takes no arguments" error

    • @jimmlmao
      @jimmlmao ปีที่แล้ว +1

      you didnt code the initializer correctly

    • @PDsChannel0112
      @PDsChannel0112 ปีที่แล้ว +1

      @@jimmlmao OK so what's the right way to do it?

    • @jimmlmao
      @jimmlmao ปีที่แล้ว +1

      @@PDsChannel0112 To write the __init__ method correctly

  • @yshlr
    @yshlr 5 วันที่ผ่านมา

    this error pops up when i try the code:
    Traceback (most recent call last):
    File "c:\Users\ASUS\Desktop\sapphire\shell.py", line 5, in
    result, error = basic.run(text)
    ^^^^^^^^^
    AttributeError: module 'basic' has no attribute 'run'

  • @slimestaff1
    @slimestaff1 2 หลายเดือนก่อน

    Hey, how's everything going?
    Great vid, everything worked, except the fact that it doesn't show the result, only the tokens, can you help?

    • @CodePulse
      @CodePulse  2 หลายเดือนก่อน

      Thanks you will not see result until ep 3.

    • @slimestaff1
      @slimestaff1 2 หลายเดือนก่อน

      @@CodePulse oooohh, ok, ty!

  • @JoeyTeam31
    @JoeyTeam31 7 หลายเดือนก่อน

    In the function advance() at self.text[pos] it says its not defined could you please help me ?

  • @krzysiek1918
    @krzysiek1918 2 ปีที่แล้ว +1

    AWESOME video, thanks

    • @reinhold1616
      @reinhold1616 2 ปีที่แล้ว

      low level languages overall are better for it

  • @tomasofficial.
    @tomasofficial. 2 ปีที่แล้ว

    Hey... Please Help! when I run it says:
    Traceback (most recent call last):
    File "C:/Users//PycharmProjects/mainWORKSPACE/Basic/shell.py", line 5, in
    result, error = basic.run(text)
    File "C:\Users\User\PycharmProjects\mainWORKSPACE\Basic\basic.py", line 116, in run
    tokens, error = lexer.make_tokens()
    ValueError: not enough values to unpack (expected 2, got 0)
    How do I fix it PLEASEEEE! I LOVE IT AND I DONT WANT TO END IT HERE

  • @DuffkaBigNerd
    @DuffkaBigNerd 4 ปีที่แล้ว

    when you say follow along with any other language
    does that mean any other ver of python or like c++ or java?

    • @CodePulse
      @CodePulse  4 ปีที่แล้ว

      Yes any other language like c++ or java. There will of course be many differences, but the core concepts remain the same.

  • @CaptainAwesomeVlog
    @CaptainAwesomeVlog 3 ปีที่แล้ว

    I had to write a C to MIPS32 compiler in university. TBH this looks much nicer.